From 2ff64931b24cc198713474656436f1c0f800f069 Mon Sep 17 00:00:00 2001 From: evgeny Date: Fri, 16 Feb 2024 19:46:23 +0300 Subject: [PATCH 01/12] #222-create-form-refund-component --- src/app/router/AppRouter/ui/AppRouter.tsx | 5 + .../blog-categories.module.scss | 2 - .../FormReturn/FormReturn.module.scss | 126 ++++++++ src/components/FormReturn/FormReturn.tsx | 277 ++++++++++++++++++ src/components/FormReturn/FormReturnType.tsx | 13 + .../HelpCategories/HelpCategories.module.scss | 22 ++ .../HelpCategories/HelpCategories.tsx | 22 ++ src/components/header/header.module.scss | 1 + src/components/header/header.tsx | 10 +- .../login/model/validation/validation.ts | 19 +- src/pages/HelpPage/HelpPage.module.scss | 64 ++++ src/pages/HelpPage/HelpPage.tsx | 31 ++ src/shared/config/routerConfig/routes.ts | 3 +- src/shared/date/checkDateIsEqual.ts | 4 + src/shared/date/checkIsToday.ts | 7 + src/shared/date/createDate.ts | 40 +++ src/shared/date/createMonth.ts | 36 +++ src/shared/date/createYear.ts | 39 +++ src/shared/date/formatDate.ts | 19 ++ src/shared/date/getMonthNumberOfDays.ts | 2 + src/shared/date/getMonthesNames.ts | 23 ++ src/shared/date/getWeekDaysNames.ts | 21 ++ src/shared/date/getWeekNumber.ts | 6 + src/shared/date/index.ts | 10 + src/shared/images/footer/arrow.svg | 3 + src/shared/ui/Button/Button.module.scss | 4 + src/shared/ui/Button/Button.stories.tsx | 6 + src/shared/ui/Button/Button.tsx | 19 +- 28 files changed, 822 insertions(+), 12 deletions(-) create mode 100644 src/components/FormReturn/FormReturn.module.scss create mode 100644 src/components/FormReturn/FormReturn.tsx create mode 100644 src/components/FormReturn/FormReturnType.tsx create mode 100644 src/components/HelpCategories/HelpCategories.module.scss create mode 100644 src/components/HelpCategories/HelpCategories.tsx create mode 100644 src/pages/HelpPage/HelpPage.module.scss create mode 100644 src/pages/HelpPage/HelpPage.tsx create mode 100644 src/shared/date/checkDateIsEqual.ts create mode 100644 src/shared/date/checkIsToday.ts create mode 100644 src/shared/date/createDate.ts create mode 100644 src/shared/date/createMonth.ts create mode 100644 src/shared/date/createYear.ts create mode 100644 src/shared/date/formatDate.ts create mode 100644 src/shared/date/getMonthNumberOfDays.ts create mode 100644 src/shared/date/getMonthesNames.ts create mode 100644 src/shared/date/getWeekDaysNames.ts create mode 100644 src/shared/date/getWeekNumber.ts create mode 100644 src/shared/date/index.ts create mode 100644 src/shared/images/footer/arrow.svg diff --git a/src/app/router/AppRouter/ui/AppRouter.tsx b/src/app/router/AppRouter/ui/AppRouter.tsx index 28420af7..81cc36b6 100644 --- a/src/app/router/AppRouter/ui/AppRouter.tsx +++ b/src/app/router/AppRouter/ui/AppRouter.tsx @@ -10,6 +10,7 @@ import ComparePage from '@/pages/ComparePage/ComparePage' import FavoritesPage from '@/pages/FavoritesPage/FavoritesPage' import CartPage from '@/pages/CartPage/CartPage' import SearchResultsPage from '@/pages/SearchResultsPage/SearchResultsPage' +import HelpPage from '@/pages/HelpPage/HelpPage' export const AppRouter = createBrowserRouter([ { @@ -53,6 +54,10 @@ export const AppRouter = createBrowserRouter([ { path: Routes.SEARCH, element: + }, + { + path: Routes.HELP, + element: } ] } diff --git a/src/components/BlogCategories/blog-categories.module.scss b/src/components/BlogCategories/blog-categories.module.scss index 6e8ed1d3..47b03eb1 100644 --- a/src/components/BlogCategories/blog-categories.module.scss +++ b/src/components/BlogCategories/blog-categories.module.scss @@ -8,8 +8,6 @@ border-radius: 10px; background: #fff; - - &__items { margin-top: 25px; max-width: 280px; diff --git a/src/components/FormReturn/FormReturn.module.scss b/src/components/FormReturn/FormReturn.module.scss new file mode 100644 index 00000000..9a7b1238 --- /dev/null +++ b/src/components/FormReturn/FormReturn.module.scss @@ -0,0 +1,126 @@ +@use '../../shared/styles/utils/variables' as var; + +.formReturn { + width: 1200px; + padding: 40px 30px 65px; + align-items: flex-start; + border-radius: 10px; + background: var.$white; + + &__title { + margin: 15px 0; + } + + &__label { + font-size: 12px; + position: relative; + + &_date[data-no-star]::before { + content: ''; + } + } + + &__label::before { + content: '*'; + color: var.$promo-color; + margin-right: 3px; + + &_date[data-no-star]::before { + content: ''; + } + } + + &__radio { + min-height: 20px; + max-width: 20px; + background-color: var.$theme-primary-color; + margin: 10px 15px 10px 0; + border-color: var.$body-color; + cursor: pointer; + } + + &__input { + margin: 0 0 25px; + padding: 12px; + border-radius: 10px; + background-color: var.$body-bg; + border: 2px solid var.$border-color; + } + + &__input:focus { + border: 2px solid var.$theme-primary-color; + transition: 0.7s; + } + + &__error { + color: var.$promo-color; + margin: 0 0 10px; + margin-top: -28px; + margin-bottom: 3px; + } + + &__textArea { + margin: 12px 0; + min-height: 200px; + padding: 10px; + border-radius: 10px; + background-color: var.$body-bg; + border: 2px solid var.$border-color; + } + + &__textArea:focus { + border: 2px solid var.$theme-primary-color; + transition: 0.7s; + } + + &__buttonContainer { + display: flex; + gap: 10px; + } + + input[type='radio'] { + visibility: hidden; + } + + &__container { + display: flex; + flex-direction: column; + } + + &__checkbox { + display: flex; + align-items: center; + cursor: pointer; + margin-left: -30px; + } + + &__radioCustom { + /* Стилизация кастомного элемента радио-кнопки */ + width: 20px; + height: 20px; + border-radius: 50%; + border: 1px solid var.$body-color-light-grey; + margin-right: 10px; + position: relative; + } + + &__radioCustom::before { + /* Стили для индикатора выбора */ + content: ''; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + width: 10px; + height: 10px; + border-radius: 50%; + background-color: transparent; + transition: background-color 0.2s; + } + + &__radio:checked + &__radioCustom::before { + width: 14px; + height: 14px; + background-color: var.$theme-primary-color; + } +} diff --git a/src/components/FormReturn/FormReturn.tsx b/src/components/FormReturn/FormReturn.tsx new file mode 100644 index 00000000..a940461f --- /dev/null +++ b/src/components/FormReturn/FormReturn.tsx @@ -0,0 +1,277 @@ +import styles from './FormReturn.module.scss' +import Heading, { HeadingType } from '@/shared/ui/Heading/Heading' +import { Field, ErrorMessage, Formik, Form } from 'formik' +import { Input } from '@/shared/ui/Input/Input' +import { validationSchema } from '../../features/login/model/validation/validation' +import classNames from 'classnames' +import { Textarea } from '@/shared/ui/Textarea/Textarea' +import { Button, ButtonTheme, ButtonDesign, ButtonSize } from '../../shared/ui/Button/Button' +import Label from '../../shared/ui/Label/Label' +import { TypeValues } from './FormReturnType' + +function FormReturn() { + const initialValues: TypeValues = { + name: '', + surname: '', + email: '', + tel: '', + numberOrder: '', + dateOrder: '', + itemInfo: '', + model: '', + amount: '', + textArea: '', + myChoice: '' + } + + return ( + <> + { + console.log('succes') + }} + initialValues={initialValues}> +
+

Пожалуйста, заполните форму запроса на возврат товара.

+ + Информация о заказе + + + + + + + + + Информация о товаре + + + + +
+
+ Причина возврата + + + + + +
+
+
+
+ Товар распакован + + +
+
+