From 1a45392ecddd87e6867747c550bec2418fe53065 Mon Sep 17 00:00:00 2001 From: Siarhei_Dzeraviannik Date: Fri, 1 Dec 2023 12:14:21 +0300 Subject: [PATCH] [Site]: updated query string for theme, removed prefix 'uui-theme' --- app/src/common/AppHeader.tsx | 34 ++++++++++--------- app/src/common/docs/BaseDocsBlock.tsx | 15 ++++---- .../docs/componentEditor/ComponentEditor.tsx | 4 +-- app/src/common/docs/componentEditor/utils.ts | 12 +++---- app/src/documents/DocumentsPage.tsx | 4 +-- app/src/helpers/getCurrentTheme.ts | 7 ++++ app/src/helpers/index.ts | 1 + app/src/helpers/useTheme.tsx | 11 +++--- 8 files changed, 47 insertions(+), 41 deletions(-) create mode 100644 app/src/helpers/getCurrentTheme.ts diff --git a/app/src/common/AppHeader.tsx b/app/src/common/AppHeader.tsx index d361c323e2..a48378f469 100644 --- a/app/src/common/AppHeader.tsx +++ b/app/src/common/AppHeader.tsx @@ -1,23 +1,25 @@ import React from 'react'; -import { BurgerButton, MainMenu, FlexSpacer, GlobalMenu, MainMenuButton, Text, IconContainer, Burger, DropdownMenuBody, Dropdown, DropdownMenuButton, Button } from '@epam/uui'; +import { + Burger, BurgerButton, Button, Dropdown, DropdownMenuBody, DropdownMenuButton, FlexSpacer, GlobalMenu, IconContainer, + MainMenu, MainMenuButton, Text, +} from '@epam/uui'; import { Anchor, MainMenuCustomElement } from '@epam/uui-components'; import { svc } from '../services'; import { analyticsEvents } from '../analyticsEvents'; import { useTheme } from '../helpers/useTheme'; -import { TMode } from './docs'; +import { TMode, TTheme } from './docs'; import { ReactComponent as GitIcon } from '../icons/git-branch-18.svg'; import { ReactComponent as LogoIcon } from '../icons/logo.svg'; import { ReactComponent as DoneIcon } from '@epam/assets/icons/common/notification-done-18.svg'; 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 = { - 'uui-theme-promo': 'Promo', - 'uui-theme-loveship': 'Loveship Light', - 'uui-theme-loveship_dark': 'Loveship Dark', - 'uui-theme-electric': 'Electric', - 'uui-theme-vanilla_thunder': 'Vanilla Thunder', -} as const; +const themeName: Record = { + [TTheme.promo]: 'Promo', + [TTheme.loveship]: 'Loveship Light', + [TTheme.loveship_dark]: 'Loveship Dark', + [TTheme.electric]: 'Electric', + [TTheme.vanilla_thunder]: 'Vanilla Thunder', +}; const GIT_LINK = 'https://github.com/epam/UUI'; @@ -67,15 +69,15 @@ export function AppHeader() { ( - toggleTheme('uui-theme-promo') } /> - toggleTheme('uui-theme-loveship') } /> - toggleTheme('uui-theme-loveship_dark') } /> - toggleTheme('uui-theme-electric') } /> - toggleTheme('uui-theme-vanilla_thunder') } /> + toggleTheme(TTheme.promo) } /> + toggleTheme(TTheme.loveship) } /> + toggleTheme(TTheme.loveship_dark) } /> + toggleTheme(TTheme.electric) } /> + toggleTheme(TTheme.vanilla_thunder) } /> ) } renderTarget={ (props) => ( -