diff --git a/src/app/providers/ThemeProvider/lib/useTheme.ts b/src/app/providers/ThemeProvider/lib/useTheme.ts index e9fb7dd..6cd80d2 100644 --- a/src/app/providers/ThemeProvider/lib/useTheme.ts +++ b/src/app/providers/ThemeProvider/lib/useTheme.ts @@ -12,17 +12,17 @@ export function useTheme(): UseThemeResult { const toggleTheme = () => { let newTheme: Theme; switch (theme) { - case Theme.DARK: - newTheme = Theme.LIGHT; - break; - case Theme.LIGHT: - newTheme = Theme.PURPLE; - break; - case Theme.PURPLE: - newTheme = Theme.DARK; - break; - default: - newTheme = Theme.LIGHT; + case Theme.DARK: + newTheme = Theme.LIGHT; + break; + case Theme.LIGHT: + newTheme = Theme.PURPLE; + break; + case Theme.PURPLE: + newTheme = Theme.DARK; + break; + default: + newTheme = Theme.LIGHT; } setTheme?.(newTheme); document.body.className = newTheme; diff --git a/src/app/styles/index.scss b/src/app/styles/index.scss index 04bb0ae..22b75ab 100644 --- a/src/app/styles/index.scss +++ b/src/app/styles/index.scss @@ -32,4 +32,3 @@ body { border-radius: 20px; /* закругления плашки */ border: 2px solid var(--primary-color); /* padding вокруг плашки */ } - diff --git a/src/entities/Article/ui/ArticleDetails/ArticleDetails.module.scss b/src/entities/Article/ui/ArticleDetails/ArticleDetails.module.scss index 1230538..225a6c0 100644 --- a/src/entities/Article/ui/ArticleDetails/ArticleDetails.module.scss +++ b/src/entities/Article/ui/ArticleDetails/ArticleDetails.module.scss @@ -1,4 +1,3 @@ .avatar { margin: 0 auto; } - diff --git a/src/entities/Article/ui/ArticleDetails/ArticleDetails.tsx b/src/entities/Article/ui/ArticleDetails/ArticleDetails.tsx index 27daef2..e380857 100644 --- a/src/entities/Article/ui/ArticleDetails/ArticleDetails.tsx +++ b/src/entities/Article/ui/ArticleDetails/ArticleDetails.tsx @@ -10,6 +10,7 @@ import { Avatar } from 'shared/ui/Avatar/Avatar'; import EyeIcon from 'shared/assets/icon/eye-20-20.svg'; import CalendarIcon from 'shared/assets/icon/calendar-20-20.svg'; import { Icon } from 'shared/ui/Icon/Icon'; +import { HStack, VStack } from 'shared/ui/Stack'; import { ArticleCodeBlockComponent } from '../ArticleCodeBlockComponent/ArticleCodeBlockComponent'; import { ArticleImageBlockComponent } from '../ArticleImageBlockComponent/ArticleImageBlockComponent'; import { ArticleTextBlockComponent } from '../ArticleTextBlockComponent/ArticleTextBlockComponent'; @@ -22,7 +23,6 @@ import { getArticleDetailsIsLoading, } from '../../model/selectors/articleDetails'; import { ArticleBlock, ArticleBlockType } from '../../model/types/article'; -import {HStack, VStack} from "shared/ui/Stack"; interface ArticleDetailsProps { className?: string; diff --git a/src/entities/Comment/ui/CommentCard/CommentCard.tsx b/src/entities/Comment/ui/CommentCard/CommentCard.tsx index 2e4ba03..59da6fd 100644 --- a/src/entities/Comment/ui/CommentCard/CommentCard.tsx +++ b/src/entities/Comment/ui/CommentCard/CommentCard.tsx @@ -5,9 +5,9 @@ import { Text } from 'shared/ui/Text/Text'; import { Skeleton } from 'shared/ui/Skeleton/Skeleton'; import { AppLink } from 'shared/ui/AppLink/AppLink'; import { RoutePath } from 'shared/config/routeConfig/routeConfig'; +import { VStack } from 'shared/ui/Stack'; import { Comment } from '../../model/types/comment'; import cls from './CommentCard.module.scss'; -import {VStack} from "shared/ui/Stack"; interface CommentCardProps { className?: string; diff --git a/src/entities/Comment/ui/CommentList/CommentList.tsx b/src/entities/Comment/ui/CommentList/CommentList.tsx index d310ca4..5a81806 100644 --- a/src/entities/Comment/ui/CommentList/CommentList.tsx +++ b/src/entities/Comment/ui/CommentList/CommentList.tsx @@ -1,9 +1,9 @@ import { memo } from 'react'; import { useTranslation } from 'react-i18next'; import { Text } from 'shared/ui/Text/Text'; +import { VStack } from 'shared/ui/Stack'; import { Comment } from '../../model/types/comment'; import { CommentCard } from '../CommentCard/CommentCard'; -import {VStack} from "shared/ui/Stack"; interface CommentListProps { comments?: Comment[]; diff --git a/src/entities/Country/ui/CountrySelect/CountrySelect.tsx b/src/entities/Country/ui/CountrySelect/CountrySelect.tsx index c781da9..cbd2f49 100644 --- a/src/entities/Country/ui/CountrySelect/CountrySelect.tsx +++ b/src/entities/Country/ui/CountrySelect/CountrySelect.tsx @@ -1,7 +1,7 @@ import { useTranslation } from 'react-i18next'; -import {memo, useCallback} from 'react'; +import { memo, useCallback } from 'react'; +import { ListBox } from 'shared/ui/ListBox/ListBox'; import { Country } from '../../model/types/country'; -import {ListBox} from "shared/ui/ListBox/ListBox"; interface CountrySelectProps { className?: string; @@ -20,6 +20,7 @@ const options = [ export const CountrySelect = memo((props: CountrySelectProps) => { const { + className, value, onChange, readonly, diff --git a/src/entities/Currency/ui/CurrencySelect/CurrencySelect.tsx b/src/entities/Currency/ui/CurrencySelect/CurrencySelect.tsx index 6de430a..058059d 100644 --- a/src/entities/Currency/ui/CurrencySelect/CurrencySelect.tsx +++ b/src/entities/Currency/ui/CurrencySelect/CurrencySelect.tsx @@ -1,7 +1,7 @@ import { useTranslation } from 'react-i18next'; import { memo, useCallback } from 'react'; +import { ListBox } from 'shared/ui/ListBox/ListBox'; import { Currency } from '../../model/types/currency'; -import { ListBox } from "shared/ui/ListBox/ListBox"; interface CurrencySelectProps { className?: string; diff --git a/src/entities/Profile/ui/ProfileCard.tsx b/src/entities/Profile/ui/ProfileCard.tsx index 5f3a081..176e50a 100644 --- a/src/entities/Profile/ui/ProfileCard.tsx +++ b/src/entities/Profile/ui/ProfileCard.tsx @@ -8,9 +8,9 @@ import { Currency } from 'entities/Currency/model/types/currency'; import { CurrencySelect } from 'entities/Currency'; import { Country } from 'entities/Country/model/types/country'; import { CountrySelect } from 'entities/Country'; +import { HStack, VStack } from 'shared/ui/Stack'; import cls from './ProfileCard.module.scss'; import { Profile } from '../model/types/profile'; -import {HStack, VStack} from "shared/ui/Stack"; interface ProfileCardProps { className?: string; @@ -54,7 +54,8 @@ export const ProfileCard = (props: ProfileCardProps) => { + className={classNames(cls.ProfileCard, { [cls.loading]: true }, [className])} + > ); @@ -79,57 +80,57 @@ export const ProfileCard = (props: ProfileCardProps) => { return ( - {data?.avatar && ( - - - - )} - - - - - - - - + {data?.avatar && ( + + + + )} + + + + + + + + ); }; diff --git a/src/features/addCommentForm/ui/AddCommentForm/AddCommentForm.tsx b/src/features/addCommentForm/ui/AddCommentForm/AddCommentForm.tsx index 255d505..1992c0f 100644 --- a/src/features/addCommentForm/ui/AddCommentForm/AddCommentForm.tsx +++ b/src/features/addCommentForm/ui/AddCommentForm/AddCommentForm.tsx @@ -6,10 +6,10 @@ import { Button, ButtonTheme } from 'shared/ui/Button/Button'; import { useSelector } from 'react-redux'; import { useAppDispatch } from 'shared/lib/hooks/useAppDispatch/useAppDispatch'; import { DynamicModuleLoader, ReducersList } from 'shared/lib/components/DynamicModuleLoader/DynamicModuleLoader'; +import { HStack } from 'shared/ui/Stack'; import { addCommentFormActions, addCommentFormReducer } from '../../model/slices/addCommentFormSlice'; import { getAddCommentFormError, getAddCommentFormText } from '../../model/selectors/addCommentFormSelectors'; import cls from './AddCommentForm.module.scss'; -import {HStack} from "shared/ui/Stack"; export interface AddCommentFormProps { className?: string; @@ -41,7 +41,8 @@ const AddCommentForm = memo((props: AddCommentFormProps) => { + className={classNames(cls.AddCommentForm, {}, [className])} + > { const { t } = useTranslation(); diff --git a/src/pages/ArticleDetailsPage/ui/ArticleDetailsPage/ArticleDetailsPage.tsx b/src/pages/ArticleDetailsPage/ui/ArticleDetailsPage/ArticleDetailsPage.tsx index c47ccb0..6d17c90 100644 --- a/src/pages/ArticleDetailsPage/ui/ArticleDetailsPage/ArticleDetailsPage.tsx +++ b/src/pages/ArticleDetailsPage/ui/ArticleDetailsPage/ArticleDetailsPage.tsx @@ -11,6 +11,7 @@ import { useInitialEffect } from 'shared/lib/hooks/useInitialEffect/useInitialEf import { useAppDispatch } from 'shared/lib/hooks/useAppDispatch/useAppDispatch'; import { AddCommentForm } from 'features/addCommentForm'; import { Page } from 'widgets/Page/Page'; +import { VStack } from 'shared/ui/Stack'; import { articleDetailsPageReducer } from '../../model/slices'; import { getArticleRecommendations } from '../../model/slices/articleDetailsPageRecommendationsSlice'; import { getArticleRecommendationsIsLoading } from '../../model/selectors/recommendations'; @@ -23,7 +24,6 @@ import { addCommentForArticle } from '../../model/services/addCommentForArticle/ import { getArticleCommentsIsLoading } from '../../model/selectors/comments'; import cls from './ArticleDetailsPage.module.scss'; import { ArticleDetailsPageHeader } from '../ArticleDetailsPageHeader/ArticleDetailsPageHeader'; -import {VStack} from "shared/ui/Stack"; interface ArticleDetailsPageProps { className?: string; diff --git a/src/pages/ArticleDetailsPage/ui/ArticleDetailsPageHeader/ArticleDetailsPageHeader.tsx b/src/pages/ArticleDetailsPage/ui/ArticleDetailsPageHeader/ArticleDetailsPageHeader.tsx index ce8adc3..a0cb961 100644 --- a/src/pages/ArticleDetailsPage/ui/ArticleDetailsPageHeader/ArticleDetailsPageHeader.tsx +++ b/src/pages/ArticleDetailsPage/ui/ArticleDetailsPageHeader/ArticleDetailsPageHeader.tsx @@ -6,8 +6,8 @@ import { RoutePath } from 'shared/config/routeConfig/routeConfig'; import { Button, ButtonTheme } from 'shared/ui/Button/Button'; import { useSelector } from 'react-redux'; import { getArticleDetailsData } from 'entities/Article/model/selectors/articleDetails'; +import { HStack } from 'shared/ui/Stack'; import { getCanEditArticle } from '../../model/selectors/article'; -import {HStack} from "shared/ui/Stack"; interface ArticleDetailsPageHeaderProps { className?: string; diff --git a/src/pages/MainPage/ui/MainPage.tsx b/src/pages/MainPage/ui/MainPage.tsx index 8898e26..0d1377a 100644 --- a/src/pages/MainPage/ui/MainPage.tsx +++ b/src/pages/MainPage/ui/MainPage.tsx @@ -1,5 +1,5 @@ import { useTranslation } from 'react-i18next'; -import {Page} from "widgets/Page/Page"; +import { Page } from 'widgets/Page/Page'; const MainPage = () => { const { t } = useTranslation(); diff --git a/src/pages/ProfilePage/ui/ProfilePage.tsx b/src/pages/ProfilePage/ui/ProfilePage.tsx index 35d8986..477b27a 100644 --- a/src/pages/ProfilePage/ui/ProfilePage.tsx +++ b/src/pages/ProfilePage/ui/ProfilePage.tsx @@ -21,8 +21,8 @@ import { useTranslation } from 'react-i18next'; import { useInitialEffect } from 'shared/lib/hooks/useInitialEffect/useInitialEffect'; import { useParams } from 'react-router-dom'; import { Page } from 'widgets/Page/Page'; +import { VStack } from 'shared/ui/Stack'; import { ProfilePageHeader } from './ProfilePageHeader/ProfilePageHeader'; -import {VStack} from "shared/ui/Stack"; const reducers: ReducersList = { profile: profileReducer, diff --git a/src/shared/ui/ListBox/ListBox.module.scss b/src/shared/ui/ListBox/ListBox.module.scss index 743d7b3..5ab9cc8 100644 --- a/src/shared/ui/ListBox/ListBox.module.scss +++ b/src/shared/ui/ListBox/ListBox.module.scss @@ -50,4 +50,3 @@ right: 0; bottom: 100%; } - diff --git a/src/shared/ui/ListBox/ListBox.stories.tsx b/src/shared/ui/ListBox/ListBox.stories.tsx index 5c5a8c6..f110c06 100644 --- a/src/shared/ui/ListBox/ListBox.stories.tsx +++ b/src/shared/ui/ListBox/ListBox.stories.tsx @@ -10,7 +10,16 @@ export default { backgroundColor: { control: 'color' }, }, decorators: [ - (Story) =>
, + (Story) => ( +
+ +
+ ), ], } as ComponentMeta; diff --git a/src/shared/ui/ListBox/ListBox.tsx b/src/shared/ui/ListBox/ListBox.tsx index 4b3ebf5..009a89f 100644 --- a/src/shared/ui/ListBox/ListBox.tsx +++ b/src/shared/ui/ListBox/ListBox.tsx @@ -87,4 +87,3 @@ export function ListBox(props: ListBoxProps) {
); } - diff --git a/src/shared/ui/Stack/HStack/HStack.tsx b/src/shared/ui/Stack/HStack/HStack.tsx index 04a0e6b..f551bc0 100644 --- a/src/shared/ui/Stack/HStack/HStack.tsx +++ b/src/shared/ui/Stack/HStack/HStack.tsx @@ -2,8 +2,6 @@ import { Flex, FlexProps } from '../Flex/Flex'; type HStackProps = Omit -export const HStack = (props: HStackProps) => { - return ( - - ); -}; +export const HStack = (props: HStackProps) => ( + +); diff --git a/src/shared/ui/Text/Text.module.scss b/src/shared/ui/Text/Text.module.scss index a69f8ac..c67b76c 100644 --- a/src/shared/ui/Text/Text.module.scss +++ b/src/shared/ui/Text/Text.module.scss @@ -6,16 +6,6 @@ color: var(--secondary-color); } -.inverted { - .title { - color: var(--inverted-primary-color); - } - - .text { - color: var(--inverted-secondary-color); - } -} - .error { .title { color: var(--red-light); diff --git a/src/widgets/Page/Page.module.scss b/src/widgets/Page/Page.module.scss index f2c9d45..03dd6b6 100644 --- a/src/widgets/Page/Page.module.scss +++ b/src/widgets/Page/Page.module.scss @@ -9,4 +9,4 @@ .trigger { height: 20px; margin: 10px; -} \ No newline at end of file +}