Skip to content

Commit

Permalink
Merge pull request #1755 from epam/bugfix/fixPack_Nov16
Browse files Browse the repository at this point in the history
fixPack-Nov16 & portal theme class
  • Loading branch information
AlekseyManetov authored Nov 17, 2023
2 parents 0a58791 + 8374580 commit 0233df1
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 45 deletions.
13 changes: 7 additions & 6 deletions app/src/common/AppHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import React from 'react';
import {
BurgerButton, MainMenu, FlexSpacer, GlobalMenu, MainMenuButton, Text, IconContainer, Burger, DropdownMenuSplitter, MainMenuDropdown,
} from '@epam/promo';
import { BurgerButton, MainMenu, FlexSpacer, GlobalMenu, MainMenuButton, Text, IconContainer, Burger, MainMenuDropdown } from '@epam/promo';
import { Anchor, MainMenuLogo } from '@epam/uui-components';
import { UUI } from './docs';
import { svc } from '../services';
import { analyticsEvents } from '../analyticsEvents';
import css from './AppHeader.module.scss';
import { ReactComponent as GitIcon } from '../icons/git-branch-18.svg';
import { useTheme } from '../helpers/useTheme';
import css from './AppHeader.module.scss';

export type Theme = 'uui-theme-promo' | 'uui-theme-loveship' | 'uui-theme-loveship_dark' | 'uui-theme-electric' | 'uui-theme-vanilla_thunder';
const themeName: Record<Theme, 'Promo' | 'Loveship' | 'Loveship Dark' | 'Electric' | 'Vanilla Thunder'> = {
Expand Down Expand Up @@ -68,9 +66,12 @@ export function AppHeader() {
<MainMenuButton caption="Loveship" isLinkActive={ theme === 'uui-theme-loveship' } iconPosition="right" onClick={ () => toggleTheme('uui-theme-loveship') } />,
<MainMenuButton caption="Loveship Dark" isLinkActive={ theme === 'uui-theme-loveship_dark' } iconPosition="right" onClick={ () => toggleTheme('uui-theme-loveship_dark') } />,
<MainMenuButton caption="Electric" isLinkActive={ theme === 'uui-theme-electric' } iconPosition="right" onClick={ () => toggleTheme('uui-theme-electric') } />,
<DropdownMenuSplitter />,
<MainMenuButton caption="RD Portal" isLinkActive={ theme === 'uui-theme-vanilla_thunder' } iconPosition="right" onClick={ () => toggleTheme('uui-theme-vanilla_thunder') } />,
];
if (!window.location.host.includes('uui.epam.com')) {
bodyItems.push(
<MainMenuButton caption="Vanilla Thunder" isLinkActive={ theme === 'uui-theme-vanilla_thunder' } iconPosition="right" onClick={ () => toggleTheme('uui-theme-vanilla_thunder') } />,
);
}

return (
<MainMenuDropdown key="theme-switcher" caption={ `Theme: ${themeName[theme as Theme]}` }>
Expand Down
16 changes: 15 additions & 1 deletion app/src/common/docs/BaseDocsBlock.module.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
@use '~@epam/assets/theme/theme_promo' as *;
@use '~@epam/assets/theme/theme_loveship' as *;
@use '~@epam/promo/assets/styles/index.scss' as *;

:global {
.uui-theme-loveship_important.uui-theme-loveship_important.uui-theme-loveship_important.uui-theme-loveship_important {
@include theme-loveship();
}

.uui-theme-promo_important.uui-theme-promo_important.uui-theme-promo_important.uui-theme-promo_important {
@include theme-promo();
}
}


.secondary-navigation {
box-sizing: border-box;
min-height: 60px;
Expand Down Expand Up @@ -66,5 +78,7 @@
}

.theme-promo {
@include theme-promo();
:global {
@include theme-promo();
}
}
27 changes: 27 additions & 0 deletions app/src/common/docs/BaseDocsBlock.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react';
import { UuiContext, UuiContexts } from '@epam/uui-core';
import { Text, RichTextView, FlexRow, MultiSwitch, FlexSpacer, TabButton, LinkButton, ScrollBars } from '@epam/uui';
import { ComponentEditor } from './ComponentEditor';
import { svc } from '../../services';
Expand All @@ -14,6 +15,13 @@ export enum TSkin {
UUI4_promo = 'UUI4_promo',
UUI = 'UUI'
}

const themeName: Record<TSkin, string> = {
UUI4_promo: 'uui-theme-promo_important',
UUI3_loveship: 'uui-theme-loveship_important',
UUI: '',
};

const DEFAULT_SKIN = TSkin.UUI;

export const UUI3 = TSkin.UUI3_loveship;
Expand All @@ -32,6 +40,9 @@ type DocPath = {
interface BaseDocsBlockState {}

export abstract class BaseDocsBlock extends React.Component<any, BaseDocsBlockState> {
public static contextType = UuiContext;
public context: UuiContexts;

constructor(props: any) {
super(props);

Expand Down Expand Up @@ -165,7 +176,21 @@ export abstract class BaseDocsBlock extends React.Component<any, BaseDocsBlockSt
);
}

handlePortalTheme(prop: 'clear' | TSkin) {
// TODO: remove this when all our site will use one 'theme-color-picker' with PropertyExplorer
const portalId = this.context.uuiLayout.getPortalRootId();
const rootPortal = document.getElementById(portalId);

if (prop === 'clear') {
rootPortal.className = '';
} else {
rootPortal.className = themeName[prop];
}
}

handleChangeSkin(skin: TSkin) {
this.handlePortalTheme(skin);

svc.uuiRouter.redirect({
pathname: '/documents',
query: {
Expand All @@ -178,6 +203,8 @@ export abstract class BaseDocsBlock extends React.Component<any, BaseDocsBlockSt
}

handleChangeMode(mode: 'doc' | 'propsEditor') {
this.handlePortalTheme('clear');

svc.uuiRouter.redirect({
pathname: '/documents',
query: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
import * as React from 'react';
import { RichTextViewProps } from '@epam/uui-components';
import { DocBuilder } from '@epam/uui-docs';
import { RichTextViewMods } from '@epam/uui';
import { FlexRow, LinkButton, LabeledInput, ControlWrapper, TextInput, RichTextView, Panel, Anchor } from '@epam/promo';
import { DefaultContext } from '../../docs';
import { FlexRow, LabeledInput, ControlWrapper, RichTextView, Panel } from '@epam/promo';
import { LinkButton } from '@epam/promo';
import { DocBuilder } from '@epam/uui-docs';
import { RichTextViewProps } from '@epam/uui-components';
import { Anchor } from '@epam/promo';
import { Svg } from '@epam/uui-components';
import { ReactComponent as Calendar } from '@epam/assets/icons/common/action-calendar-18.svg';
import { TextInput } from '@epam/promo';
import style from './richTextViewDoc.module.scss';

const richTextViewDoc = new DocBuilder<RichTextViewProps & RichTextViewMods>({ name: 'RichTextView', component: RichTextView })
Expand Down Expand Up @@ -106,7 +101,6 @@ const richTextViewDoc = new DocBuilder<RichTextViewProps & RichTextViewMods>({ n
<Anchor href="/">
Click me
{' '}
<Svg svg={ Calendar }></Svg>
</Anchor>
{' '}
It is those feelings that drive our love of astronomy and our desire to learn more and more about it.
Expand Down Expand Up @@ -182,7 +176,6 @@ const richTextViewDoc = new DocBuilder<RichTextViewProps & RichTextViewMods>({ n
<>
Demo Component
<Anchor href="/">
<Svg svg={ Calendar }></Svg>
</Anchor>
{' '}
:
Expand Down Expand Up @@ -221,7 +214,6 @@ export const MyComponent = <div className={ css.myHeader }>`}
<Anchor href="/">
click me
{' '}
<Svg svg={ Calendar }></Svg>
</Anchor>
{' '}
consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
Expand All @@ -239,7 +231,6 @@ export const MyComponent = <div className={ css.myHeader }>`}
<Anchor href="/">
click me
{' '}
<Svg svg={ Calendar }></Svg>
</Anchor>
{' '}
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure reprehenderit in voluptate velit esse
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
import * as React from 'react';
import { DocBuilder } from '@epam/uui-docs';
import { RichTextViewProps, Svg } from '@epam/uui-components';
import { RichTextViewProps } from '@epam/uui-components';
import { RichTextViewMods } from '@epam/uui';
import {
RichTextView,
Anchor,
TextInput,
FlexRow,
LabeledInput,
ControlWrapper,
LinkButton,
Panel,
} from '@epam/loveship';
import { RichTextView, Anchor, TextInput, FlexRow, LabeledInput, ControlWrapper, LinkButton, Panel } from '@epam/loveship';
import { DefaultContext } from '../../docs';
import { ReactComponent as Calendar } from '@epam/assets/icons/common/action-calendar-18.svg';
import style from './richTextViewDoc.module.scss';

const richTextViewDoc = new DocBuilder<RichTextViewProps & RichTextViewMods>({ name: 'RichTextView', component: RichTextView })
Expand Down Expand Up @@ -95,7 +85,6 @@ const richTextViewDoc = new DocBuilder<RichTextViewProps & RichTextViewMods>({ n
<Anchor href="/">
Click me
{' '}
<Svg svg={ Calendar }></Svg>
</Anchor>
{' '}
It is those feelings that drive our love of astronomy and our desire to learn more and more about it.
Expand Down Expand Up @@ -171,7 +160,6 @@ const richTextViewDoc = new DocBuilder<RichTextViewProps & RichTextViewMods>({ n
<>
Demo Component
<Anchor href="/">
<Svg svg={ Calendar }></Svg>
</Anchor>
{' '}
:
Expand Down Expand Up @@ -210,7 +198,6 @@ export const MyComponent = <div className={ css.myHeader }>`}
<Anchor href="/">
click me
{' '}
<Svg svg={ Calendar }></Svg>
</Anchor>
{' '}
consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
Expand All @@ -228,7 +215,6 @@ export const MyComponent = <div className={ css.myHeader }>`}
<Anchor href="/">
click me
{' '}
<Svg svg={ Calendar }></Svg>
</Anchor>
{' '}
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure reprehenderit in voluptate velit esse
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import * as React from 'react';
import { DocBuilder } from '@epam/uui-docs';
import { RichTextViewProps, Svg } from '@epam/uui-components';
import { RichTextViewProps } from '@epam/uui-components';
import { RichTextView, RichTextViewMods, FlexRow, LabeledInput, LinkButton, Anchor, TextInput, Panel } from '@epam/uui';
import { DefaultContext } from '../../docs';
import { ReactComponent as Calendar } from '@epam/assets/icons/common/action-calendar-18.svg';
import style from './richTextViewDoc.module.scss';

const richTextViewDoc = new DocBuilder<RichTextViewProps & RichTextViewMods>({ name: 'RichTextView', component: RichTextView })
Expand Down Expand Up @@ -101,7 +100,6 @@ const richTextViewDoc = new DocBuilder<RichTextViewProps & RichTextViewMods>({ n
<Anchor href="/">
Click me
{' '}
<Svg svg={ Calendar }></Svg>
</Anchor>
{' '}
It is those feelings that drive our love of astronomy and our desire to learn more and more about it.
Expand Down Expand Up @@ -177,7 +175,6 @@ const richTextViewDoc = new DocBuilder<RichTextViewProps & RichTextViewMods>({ n
<>
Demo Component
<Anchor href="/">
<Svg svg={ Calendar }></Svg>
</Anchor>
{' '}
:
Expand Down Expand Up @@ -214,7 +211,6 @@ export const MyComponent = <div className={ css.myHeader }>`}
<Anchor href="/">
click me
{' '}
<Svg svg={ Calendar }></Svg>
</Anchor>
{' '}
consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
Expand All @@ -232,7 +228,6 @@ export const MyComponent = <div className={ css.myHeader }>`}
<Anchor href="/">
click me
{' '}
<Svg svg={ Calendar }></Svg>
</Anchor>
{' '}
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure reprehenderit in voluptate velit esse
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { useMemo, useState } from 'react';
import { Badge, ColumnsConfigurationModal, DataTable, FlexRow, Panel, RichTextView, Text } from '@epam/promo';
import { ColumnsConfigurationModal, DataTable, FlexRow, Panel, RichTextView, StatusIndicator, Text } from '@epam/promo';
import { DataColumnProps, useLazyDataSource, useUuiContext, UuiContexts } from '@epam/uui-core';
import { Person } from '@epam/uui-docs';
import css from './TableColumnConfigModalStyles.module.scss';
import { TApi } from '../../data';
import { ColumnsConfigurationModalProps } from '@epam/uui';
import { TApi } from '../../data';
import css from './TableColumnConfigModalStyles.module.scss';

export function TableColumnConfigModalTest() {
const svc = useUuiContext<TApi, UuiContexts>();
Expand Down Expand Up @@ -37,7 +37,7 @@ export function TableColumnConfigModalTest() {
render: (p) =>
p.profileStatus && (
<FlexRow>
<Badge fill="transparent" color={ p.profileStatus.toLowerCase() as any } caption={ p.profileStatus } />
<StatusIndicator size="18" color={ p.profileStatus.toLowerCase() as any } caption={ p.profileStatus } />
</FlexRow>
),
width: 140,
Expand Down

0 comments on commit 0233df1

Please sign in to comment.