diff --git a/.eslintrc.js b/.eslintrc.js index 9da41bd7..ff7b7c22 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -67,6 +67,7 @@ module.exports = { 'variant', 'size', 'wrap', + 'color', ], }, ], diff --git a/.loki/reference/chrome_iphone7_features_EditableProfileCard_Normal.png b/.loki/reference/chrome_iphone7_features_EditableProfileCard_Normal.png index cf2da275..0d6cf1da 100644 Binary files a/.loki/reference/chrome_iphone7_features_EditableProfileCard_Normal.png and b/.loki/reference/chrome_iphone7_features_EditableProfileCard_Normal.png differ diff --git a/.loki/reference/chrome_laptop_features_EditableProfileCard_Normal.png b/.loki/reference/chrome_laptop_features_EditableProfileCard_Normal.png index bfa917b6..ae18a12c 100644 Binary files a/.loki/reference/chrome_laptop_features_EditableProfileCard_Normal.png and b/.loki/reference/chrome_laptop_features_EditableProfileCard_Normal.png differ diff --git a/src/entities/Profile/ui/ProfileCard/ProfileCard.tsx b/src/entities/Profile/ui/ProfileCard/ProfileCard.tsx index 8a08394a..83d4c0df 100644 --- a/src/entities/Profile/ui/ProfileCard/ProfileCard.tsx +++ b/src/entities/Profile/ui/ProfileCard/ProfileCard.tsx @@ -49,7 +49,12 @@ export const ProfileCard = (props: ProfileCardProps) => { if (isLoading) { return ( - + @@ -77,23 +82,35 @@ export const ProfileCard = (props: ProfileCardProps) => { if (error) { return ( - - - + + + + ); } return ( - + diff --git a/src/features/authByUsername/ui/LoginForm/LoginForm.tsx b/src/features/authByUsername/ui/LoginForm/LoginForm.tsx index 1ece5d25..5c5cbdb7 100644 --- a/src/features/authByUsername/ui/LoginForm/LoginForm.tsx +++ b/src/features/authByUsername/ui/LoginForm/LoginForm.tsx @@ -3,15 +3,20 @@ import { useTranslation } from 'react-i18next'; import { useSelector } from 'react-redux'; import { classNames } from '@/shared/lib/classNames'; -import { Input } from '@/shared/ui/deprecated/Input'; -import { Button, ButtonTheme } from '@/shared/ui/deprecated/Button'; -import { Text, TextTheme } from '@/shared/ui/deprecated/Text'; +import { Input as InputDeprecated } from '@/shared/ui/deprecated/Input'; +import { Input } from '@/shared/ui/redesigned/Input'; +import { Button as ButtonDeprecated, ButtonTheme } from '@/shared/ui/deprecated/Button'; +import { Button } from '@/shared/ui/redesigned/Button'; +import { Text as TextDeprecated, TextTheme } from '@/shared/ui/deprecated/Text'; +import { Text } from '@/shared/ui/redesigned/Text'; import { DynamicModuleLoader, ReducersList, } from '@/shared/lib/components/DynamicModuleLoader/DynamicModuleLoader'; import { useAppDispatch } from '@/shared/lib/hooks/useAppDispatch/useAppDispatch'; import { useTheme } from '@/shared/lib/hooks/useTheme/useTheme'; +import { ToggleFeatures } from '@/shared/lib/features'; +import { VStack } from '@/shared/ui/redesigned/Stack'; import { getLoginUsername } from '../../model/selectors/getLoginUsername/getLoginUsername'; import { getLoginPassword } from '../../model/selectors/getLoginPassword/getLoginPassword'; @@ -70,37 +75,72 @@ export const LoginForm = memo((props: LoginFormProps) => { return ( -
- - - {error && } - - - - - - -
+ + + + {error && } + + + + + + +
+ } + off={ +
+ + + {error && ( + + )} + + + + + + + {t('Войти')} + +
+ } + /> ); }); diff --git a/src/features/editableProfileCard/ui/EditableProfileCard/EditableProfileCard.tsx b/src/features/editableProfileCard/ui/EditableProfileCard/EditableProfileCard.tsx index 9bfecfe7..8fe50d5e 100644 --- a/src/features/editableProfileCard/ui/EditableProfileCard/EditableProfileCard.tsx +++ b/src/features/editableProfileCard/ui/EditableProfileCard/EditableProfileCard.tsx @@ -7,7 +7,8 @@ import { useAppDispatch } from '@/shared/lib/hooks/useAppDispatch/useAppDispatch import { useInitialEffect } from '@/shared/lib/hooks/useInitialEffect/useInitialEffect'; import { Currency } from '@/entities/Currency'; import { Country } from '@/entities/Country'; -import { Text, TextTheme } from '@/shared/ui/deprecated/Text'; +import { Text as TextDeprecated, TextTheme } from '@/shared/ui/deprecated/Text'; +import { Text } from '@/shared/ui/redesigned/Text'; import { ProfileCardFactory } from '@/entities/Profile'; import { DynamicModuleLoader, @@ -15,6 +16,7 @@ import { } from '@/shared/lib/components/DynamicModuleLoader/DynamicModuleLoader'; import { VStack } from '@/shared/ui/redesigned/Stack'; import { AppRoutes } from '@/shared/const/router'; +import { ToggleFeatures } from '@/shared/lib/features'; import { ValidateProfileError } from '../../model/consts/consts'; import { EditableProfileCardHeader } from '../EditableProfileCardHeader/EditableProfileCardHeader'; @@ -126,16 +128,29 @@ export const EditableProfileCard = memo((props: EditableProfileCardProps) => { return ( - + {!!validateErrors?.length && validateErrors.map((err) => ( - + } + off={ + + } /> ))} diff --git a/src/features/editableProfileCard/ui/EditableProfileCardHeader/EditableProfileCardHeader.tsx b/src/features/editableProfileCard/ui/EditableProfileCardHeader/EditableProfileCardHeader.tsx index 7d8e170c..ac5fd3c5 100644 --- a/src/features/editableProfileCard/ui/EditableProfileCardHeader/EditableProfileCardHeader.tsx +++ b/src/features/editableProfileCard/ui/EditableProfileCardHeader/EditableProfileCardHeader.tsx @@ -6,9 +6,13 @@ import { classNames } from '@/shared/lib/classNames'; import { useAppDispatch } from '@/shared/lib/hooks/useAppDispatch/useAppDispatch'; import { getUserAuthData } from '@/entities/User'; import { HStack } from '@/shared/ui/redesigned/Stack'; -import { Text } from '@/shared/ui/deprecated/Text'; -import { Button, ButtonTheme } from '@/shared/ui/deprecated/Button'; +import { Text as TextDeprecated } from '@/shared/ui/deprecated/Text'; +import { Text } from '@/shared/ui/redesigned/Text'; +import { Button as ButtonDeprecated, ButtonTheme } from '@/shared/ui/deprecated/Button'; +import { Button } from '@/shared/ui/redesigned/Button'; import { AppRoutes } from '@/shared/const/router'; +import { ToggleFeatures } from '@/shared/lib/features'; +import { Card } from '@/shared/ui/redesigned/Card'; import { profileActions } from '../../model/slice/profileSlice'; import { updateProfileData } from '../../model/services/updateProfileData/updateProfileData'; @@ -42,38 +46,75 @@ export const EditableProfileCardHeader = memo((props: EditableProfileCardHeaderP }, [dispatch]); return ( - - + + + - {canEdit && - (readonly ? ( - - ) : ( - - + {canEdit && + (readonly ? ( + + ) : ( + + - + + + ))} - ))} - +
+ } + off={ + + + + {canEdit && + (readonly ? ( + + {t('Редактировать')} + + ) : ( + + + {t('Отменить')} + + + + {t('Сохранить')} + + + ))} + + } + /> ); }); diff --git a/src/pages/ProfilePage/ui/ProfilePage.tsx b/src/pages/ProfilePage/ui/ProfilePage.tsx index 90060c99..821efa60 100644 --- a/src/pages/ProfilePage/ui/ProfilePage.tsx +++ b/src/pages/ProfilePage/ui/ProfilePage.tsx @@ -2,11 +2,13 @@ import { useParams } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; import { classNames } from '@/shared/lib/classNames'; -import { Text } from '@/shared/ui/deprecated/Text'; +import { Text as TextDeprecated } from '@/shared/ui/deprecated/Text'; +import { Text } from '@/shared/ui/redesigned/Text'; import { Page } from '@/widgets/Page'; import { VStack } from '@/shared/ui/redesigned/Stack'; import { EditableProfileCard } from '@/features/editableProfileCard'; import { AppRoutes } from '@/shared/const/router'; +import { ToggleFeatures } from '@/shared/lib/features'; interface ProfilePageProps { className?: string; @@ -18,7 +20,13 @@ export const ProfilePage = (props: ProfilePageProps) => { const { id } = useParams<{ id: string }>(); if (!id) { - return ; + return ( + } + off={} + /> + ); } return ( diff --git a/src/shared/ui/redesigned/Button/ui/Button.module.scss b/src/shared/ui/redesigned/Button/ui/Button.module.scss index 7045e4df..f2f81e51 100644 --- a/src/shared/ui/redesigned/Button/ui/Button.module.scss +++ b/src/shared/ui/redesigned/Button/ui/Button.module.scss @@ -47,12 +47,31 @@ .outline { background: none; - border: 2px solid var(--icon-redesigned); outline: none; border-radius: 34px; - &:hover { - border: 2px solid var(--accent-redesigned); + &.normal { + border: 2px solid var(--icon-redesigned); + + &:hover { + border: 2px solid var(--accent-redesigned); + } + } + + &.error { + border: 2px solid var(--cancel-redesigned); + + &:hover { + opacity: 0.7; + } + } + + &.success { + border: 2px solid var(--save-redesigned); + + &:hover { + opacity: 0.7; + } } } diff --git a/src/shared/ui/redesigned/Button/ui/Button.tsx b/src/shared/ui/redesigned/Button/ui/Button.tsx index 91249afc..1cf62979 100644 --- a/src/shared/ui/redesigned/Button/ui/Button.tsx +++ b/src/shared/ui/redesigned/Button/ui/Button.tsx @@ -5,6 +5,7 @@ import { classNames, Mods } from '@/shared/lib/classNames'; import cls from './Button.module.scss'; export type ButtonVariant = 'clear' | 'outline' | 'filled'; +export type ButtonColor = 'normal' | 'success' | 'error'; export type ButtonSize = 'm' | 'l' | 'xl'; @@ -21,6 +22,7 @@ interface ButtonProps extends ButtonHTMLAttributes { fullWidth?: boolean; addonLeft?: ReactNode; addonRight?: ReactNode; + color?: ButtonColor; } export const Button = memo((props: ButtonProps) => { @@ -34,6 +36,7 @@ export const Button = memo((props: ButtonProps) => { fullWidth, addonLeft, addonRight, + color = 'normal', ...otherProps } = props; @@ -47,7 +50,7 @@ export const Button = memo((props: ButtonProps) => { return ( + + - {isAuthModal && } - + {isAuthModal && } + + } + off={ +
+ + {t('Войти')} + + + {isAuthModal && } +
+ } + /> ); });