diff --git a/src/app/router/AppRouter/ui/AppRouter.tsx b/src/app/router/AppRouter/ui/AppRouter.tsx index 2169ffb2..a12fa053 100644 --- a/src/app/router/AppRouter/ui/AppRouter.tsx +++ b/src/app/router/AppRouter/ui/AppRouter.tsx @@ -23,6 +23,7 @@ import { ProductsPage } from '@/pages/ProductsPage/ProductsPage' import { ReviewsPage } from '@/pages/ReviewsPage/ReviewsPage' import RootPage from '@/pages/RootPage/RootPage' import SearchResultsPage from '@/pages/SearchResultsPage/SearchResultsPage' +import SubscriptionPage from '@/pages/SubscriptionPage/SubscriptionPage' import ShopNewsPage from '@/pages/ShopNewsPage/ShopNewsPage' import { TermsPage } from '@/pages/TermsPage/TermsPage' import VouchersPage from '@/pages/VouchersPage/VouchersPage' @@ -144,6 +145,10 @@ export const AppRouter = createBrowserRouter([ path: Routes.REGISTRATION, element: }, + { + path: Routes.NEWSLETTER, + element: + }, { path: Routes.SUBSCRIBE, element: //TODO реалзиовать страницу подписки diff --git a/src/pages/SubscriptionPage/SubscriptionPage.module.scss b/src/pages/SubscriptionPage/SubscriptionPage.module.scss new file mode 100644 index 00000000..5b70c329 --- /dev/null +++ b/src/pages/SubscriptionPage/SubscriptionPage.module.scss @@ -0,0 +1,22 @@ +@use '@/shared/styles/utils/mixins' as media; + +.info { + display:flex; + margin-top: 20px; + column-gap: 20px; + + @include media.respond-to('large') { + flex-direction: column; + row-gap: 10px; + } +} + +.container { + display: flex; + flex-direction: column; + width: 100%; +} + +.heading { + margin-bottom: 10px; +} diff --git a/src/pages/SubscriptionPage/SubscriptionPage.tsx b/src/pages/SubscriptionPage/SubscriptionPage.tsx new file mode 100644 index 00000000..c1a27456 --- /dev/null +++ b/src/pages/SubscriptionPage/SubscriptionPage.tsx @@ -0,0 +1,70 @@ +import { Suspense, useState } from 'react' + +import SideBarMenuModal from '@/features/SideBarMenuModal' +import { useResize } from '@/shared/libs/hooks/useResize' +import Breadcrumbs from '@/shared/ui/Breadcrumbs/Breadcrumbs' +import Heading, { HeadingType } from '@/shared/ui/Heading/Heading' +import Modal from '@/shared/ui/Modal/Modal' +import Spinner from '@/shared/ui/Spinner/Spinner' +import DistributionForm from '@/widgets/DistributionForm/ui/DistributionForm' +import { withAdaptiveSideBar } from '@/widgets/SideBarMenu' + +import WrapperForMainContent from '../../components/WrapperForMainContent/WrapperForMainContent' + +import styles from './SubscriptionPage.module.scss' + +const links = [ + { heading: 'Главная', href: '/' }, + { heading: 'Личный Кабинет', href: '/account' }, + { heading: 'Рассылка', href: '' } +] + +const SubscriptionPage = () => { + const [isModalOpen, setIsModalOpen] = useState(false) + const [isModalClosing, setIsModalClosing] = useState(false) + const { isScreenLg } = useResize() + const AdaptiveSideBar = withAdaptiveSideBar(isScreenLg) + + const changeModalState = () => { + setIsModalOpen(!isModalOpen) + } + + const handleClick = () => { + setIsModalOpen(true) + } + + const closeModal = () => { + setIsModalClosing(true) + } + + return ( + <> + {isModalOpen && ( + + }> + + + + )} + + +
+ + Подписка на новости + + +
+ + +
+
+
+ + ) +} + +export default SubscriptionPage diff --git a/src/shared/config/routerConfig/routes.ts b/src/shared/config/routerConfig/routes.ts index 16563427..cd47445c 100644 --- a/src/shared/config/routerConfig/routes.ts +++ b/src/shared/config/routerConfig/routes.ts @@ -30,6 +30,7 @@ export enum Routes { FORGOT_PASSWORD = '/forgot-password', REGISTRATION = '/registration', SUBSCRIBE = '/subscribe', + NEWSLETTER = '/newsletter', ERROR = '*', SHOP_NEWS = '/shopnews' } diff --git a/src/widgets/AccountSubscribe/AccountSubscribe.tsx b/src/widgets/AccountSubscribe/AccountSubscribe.tsx index b36e59f0..f54a6c80 100644 --- a/src/widgets/AccountSubscribe/AccountSubscribe.tsx +++ b/src/widgets/AccountSubscribe/AccountSubscribe.tsx @@ -14,7 +14,7 @@ import styles from './AccountSubscribe.module.scss' export const AccountSubscribe: FC = () => { return (
- +
Подписка diff --git a/src/widgets/DistributionForm/modal/types.ts b/src/widgets/DistributionForm/modal/types.ts new file mode 100644 index 00000000..353b1d2e --- /dev/null +++ b/src/widgets/DistributionForm/modal/types.ts @@ -0,0 +1,3 @@ +export interface IDistributionForm { + subscription: string +} diff --git a/src/widgets/DistributionForm/ui/DistributionForm.module.scss b/src/widgets/DistributionForm/ui/DistributionForm.module.scss new file mode 100644 index 00000000..d47e9702 --- /dev/null +++ b/src/widgets/DistributionForm/ui/DistributionForm.module.scss @@ -0,0 +1,39 @@ +@use '@/shared/styles/utils/variables' as var; +@use '@/shared/styles/utils/mixins' as media; + +.form { + display: flex; + flex-direction: column; + width: 100%; + padding: 20px 30px; + background: var.$white; + border-radius: 10px; + height: 230px; + + @include media.respond-to('small') { + height: 290px; + } + + &__title { + margin-bottom: 10px; + } + + &__list { + display: flex; + column-gap: 20px; + margin-bottom: 30px; + } + + &__buttons { + display: flex; + column-gap: 20px; + flex-direction: row; + width: 70%; + + @include media.respond-to('small') { + flex-direction: column; + row-gap: 10px; + } + } +} + diff --git a/src/widgets/DistributionForm/ui/DistributionForm.stories.tsx b/src/widgets/DistributionForm/ui/DistributionForm.stories.tsx new file mode 100644 index 00000000..36d8cf6d --- /dev/null +++ b/src/widgets/DistributionForm/ui/DistributionForm.stories.tsx @@ -0,0 +1,17 @@ +import { Meta, StoryObj } from '@storybook/react' + +import DistributionForm from './DistributionForm' + +const meta = { + title: 'widgets/DistributionForm', + component: DistributionForm, + parameters: { + layout: 'centered' + }, + tags: ['autodocs'] +} satisfies Meta + +export default meta +type Story = StoryObj + +export const Default: Story = {} diff --git a/src/widgets/DistributionForm/ui/DistributionForm.tsx b/src/widgets/DistributionForm/ui/DistributionForm.tsx new file mode 100644 index 00000000..aa6844b5 --- /dev/null +++ b/src/widgets/DistributionForm/ui/DistributionForm.tsx @@ -0,0 +1,87 @@ +import { Form, Formik } from 'formik' +import { useNavigate } from 'react-router' + +import { Routes } from '@/shared/config/routerConfig/routes' +import { Button, ButtonDesign, ButtonSize, ButtonTheme } from '@/shared/ui/Button/Button' +import Checkbox from '@/shared/ui/Checkbox/Checkbox' +import Heading, { HeadingType } from '@/shared/ui/Heading/Heading' +import Label from '@/shared/ui/Label/Label' + +import { IDistributionForm } from '../modal/types' + +import styles from './DistributionForm.module.scss' + +const initialValues: IDistributionForm = { + subscription: String('Нет') +} + +const subscription = [ + { label: 'Да', value: 'Да' }, + { label: 'Нет', value: 'Нет' } +] + +const DistributionForm = () => { + const navigate = useNavigate() + function handleRedirectPrevious() { + navigate(Routes.ACCOUNT) + } + function handleRedirectNext() { + navigate(Routes.ACCOUNT) + } + + return ( + { + setSubmitting(false) + resetForm() + }}> + {({ isSubmitting }) => ( +
+ + Рассылка + + +
+ + +
+
+ )} +
+ ) +} +export default DistributionForm