@scbt-ecom/ui 0.0.27 → 0.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env +2 -0
- package/.eslintrc.cjs +134 -0
- package/.github/workflows/npm-publish.yml +22 -0
- package/.github/workflows/publish.yml +49 -0
- package/.github/workflows/setup-node/action.yml +22 -0
- package/.husky/pre-commit +1 -0
- package/.prettierrc +19 -0
- package/.storybook/main.ts +44 -0
- package/.storybook/preview.tsx +37 -0
- package/chromatic.config.json +5 -0
- package/index.html +13 -0
- package/lib/client.ts +80 -0
- package/lib/configs/index.ts +1 -0
- package/lib/configs/tailwindConfigBase.ts +110 -0
- package/lib/server.ts +2 -0
- package/lib/shared/constants/api.ts +2 -0
- package/lib/shared/constants/designSystem/colors.ts +117 -0
- package/lib/shared/constants/designSystem/index.ts +3 -0
- package/lib/shared/constants/designSystem/others.ts +18 -0
- package/lib/shared/constants/designSystem/typography.ts +88 -0
- package/lib/shared/constants/index.ts +2 -0
- package/lib/shared/hooks/index.ts +4 -0
- package/lib/shared/hooks/useBoolean.ts +12 -0
- package/lib/shared/hooks/useClickOutside.ts +19 -0
- package/lib/shared/hooks/useControlledForm.ts +16 -0
- package/lib/shared/hooks/useDebounce.ts +38 -0
- package/lib/shared/style.css +74 -0
- package/lib/shared/ui/Badge.tsx +20 -0
- package/lib/shared/ui/Breadcrumbs.tsx +57 -0
- package/lib/shared/ui/ButtonIcon.tsx +52 -0
- package/lib/shared/ui/CustomLink.tsx +70 -0
- package/lib/shared/ui/Document.tsx +51 -0
- package/lib/shared/ui/Heading.tsx +33 -0
- package/lib/shared/ui/Hint.tsx +62 -0
- package/lib/shared/ui/Loader.tsx +58 -0
- package/lib/shared/ui/PhoneView.tsx +23 -0
- package/lib/shared/ui/Portal.tsx +9 -0
- package/lib/shared/ui/ProgressBar.tsx +43 -0
- package/lib/shared/ui/ResponsiveContainer.tsx +11 -0
- package/lib/shared/ui/Section.tsx +15 -0
- package/lib/shared/ui/Skeleton.tsx +9 -0
- package/lib/shared/ui/TabsSwitcher.tsx +80 -0
- package/lib/shared/ui/accordion/Accordion.tsx +36 -0
- package/lib/shared/ui/accordion/index.ts +1 -0
- package/lib/shared/ui/accordion/model/types.ts +20 -0
- package/lib/shared/ui/accordion/ui/AccordionHeader.tsx +35 -0
- package/lib/shared/ui/brandLogos.tsx +14 -0
- package/lib/shared/ui/button/Button.tsx +111 -0
- package/lib/shared/ui/button/index.ts +1 -0
- package/lib/shared/ui/button/model/helpers.ts +16 -0
- package/lib/shared/ui/calendar/Calendar.tsx +228 -0
- package/lib/shared/ui/calendar/index.ts +231 -0
- package/lib/shared/ui/calendar/model/animation.ts +112 -0
- package/lib/shared/ui/calendar/model/classes.ts +34 -0
- package/lib/shared/ui/calendar/model/helpers.ts +51 -0
- package/lib/shared/ui/calendar/model/hooks/index.ts +2 -0
- package/lib/shared/ui/calendar/model/hooks/useCalendarDropdowns.ts +38 -0
- package/lib/shared/ui/calendar/model/hooks/useDatePicker.ts +103 -0
- package/lib/shared/ui/calendar/ui/CalendarHeader.tsx +54 -0
- package/lib/shared/ui/calendar/ui/Dropdown.tsx +75 -0
- package/lib/shared/ui/calendar/ui/NavigationArrows.tsx +23 -0
- package/lib/shared/ui/calendar/ui/Weekdays.tsx +16 -0
- package/lib/shared/ui/calendar/ui/index.ts +2 -0
- package/lib/shared/ui/formControlElements/CheckboxControl.tsx +92 -0
- package/lib/shared/ui/formControlElements/FormControl.tsx +5 -0
- package/lib/shared/ui/formControlElements/InputControl.tsx +68 -0
- package/lib/shared/ui/formControlElements/InputControlMask.tsx +80 -0
- package/lib/shared/ui/formControlElements/RadioControl.tsx +130 -0
- package/lib/shared/ui/formControlElements/SelectControl.tsx +185 -0
- package/lib/shared/ui/formControlElements/SwitchControl.tsx +79 -0
- package/lib/shared/ui/formControlElements/TextareaControl.tsx +92 -0
- package/lib/shared/ui/formControlElements/calendarControl/CalendarControl.tsx +175 -0
- package/lib/shared/ui/formControlElements/calendarControl/hooks/index.ts +2 -0
- package/lib/shared/ui/formControlElements/calendarControl/hooks/useCalendar.tsx +86 -0
- package/lib/shared/ui/formControlElements/calendarControl/hooks/useCalendarDropdowns.ts +38 -0
- package/{dist/shared/ui/formControlElements/calendarControl/index.d.ts → lib/shared/ui/formControlElements/calendarControl/index.ts} +1 -1
- package/lib/shared/ui/formControlElements/calendarControl/model/helpers.ts +60 -0
- package/lib/shared/ui/formControlElements/calendarControl/model/types.ts +44 -0
- package/lib/shared/ui/formControlElements/calendarControl/ui/DaysOfMonth.tsx +53 -0
- package/lib/shared/ui/formControlElements/calendarControl/ui/DaysOfWeek.tsx +28 -0
- package/lib/shared/ui/formControlElements/calendarControl/ui/Dropdown.tsx +62 -0
- package/lib/shared/ui/formControlElements/calendarControl/ui/Header.tsx +51 -0
- package/lib/shared/ui/formControlElements/calendarControl/ui/Navigation.tsx +32 -0
- package/lib/shared/ui/formControlElements/calendarControl/ui/OptionsList.tsx +44 -0
- package/lib/shared/ui/formControlElements/calendarControl/ui/index.ts +4 -0
- package/lib/shared/ui/formControlElements/dadata/DadataInputControl.tsx +132 -0
- package/{dist/shared/ui/formControlElements/dadata/index.d.ts → lib/shared/ui/formControlElements/dadata/index.ts} +1 -1
- package/lib/shared/ui/formControlElements/dadata/model/api.ts +25 -0
- package/lib/shared/ui/formControlElements/dadata/model/helpers.ts +76 -0
- package/lib/shared/ui/formControlElements/dadata/model/types.ts +52 -0
- package/lib/shared/ui/formControlElements/dadata/model/useDadata.ts +25 -0
- package/{dist/shared/ui/formControlElements/index.d.ts → lib/shared/ui/formControlElements/index.ts} +10 -10
- package/lib/shared/ui/formControlElements/model/classes-types.ts +22 -0
- package/lib/shared/ui/formControlElements/model/index.ts +2 -0
- package/lib/shared/ui/formControlElements/model/props-types.ts +26 -0
- package/lib/shared/ui/formControlElements/ui/FieldAttachment.tsx +66 -0
- package/lib/shared/ui/formControlElements/ui/FieldContainer.tsx +36 -0
- package/lib/shared/ui/formControlElements/ui/FieldWrapper.tsx +55 -0
- package/lib/shared/ui/formControlElements/ui/MessageView.tsx +37 -0
- package/lib/shared/ui/formControlElements/ui/index.ts +4 -0
- package/lib/shared/ui/icon/Icon.tsx +43 -0
- package/{dist/shared/ui/icon/index.d.ts → lib/shared/ui/icon/index.ts} +2 -2
- package/lib/shared/ui/icon/sprite.gen.ts +121 -0
- package/lib/shared/ui/index.ts +56 -0
- package/lib/shared/ui/popover/Popover.tsx +77 -0
- package/lib/shared/ui/popover/index.ts +1 -0
- package/lib/shared/ui/table/Table.tsx +143 -0
- package/lib/shared/ui/table/index.ts +1 -0
- package/lib/shared/ui/table/type.ts +30 -0
- package/lib/shared/utils/capitalize.ts +6 -0
- package/lib/shared/utils/cn.ts +6 -0
- package/lib/shared/utils/deepCompare.ts +1 -0
- package/lib/shared/utils/formatToDate.ts +5 -0
- package/lib/shared/utils/index.ts +5 -0
- package/lib/shared/utils/isClient.ts +1 -0
- package/lib/shared/validation/index.ts +3 -0
- package/lib/shared/validation/messages.ts +12 -0
- package/lib/shared/validation/regExp.ts +5 -0
- package/lib/shared/validation/zodValidation/calendar.ts +32 -0
- package/lib/shared/validation/zodValidation/dadataFio.ts +67 -0
- package/lib/shared/validation/zodValidation/index.ts +2 -0
- package/lib/vite-env.d.ts +2 -0
- package/lib/widgets/Advantages.tsx +45 -0
- package/lib/widgets/banner/Banner.tsx +62 -0
- package/lib/widgets/banner/index.ts +1 -0
- package/lib/widgets/banner/model/helpers.ts +44 -0
- package/lib/widgets/banner/money.png +0 -0
- package/lib/widgets/banner/ui/BannerButtonsGroup.tsx +30 -0
- package/{dist/widgets/index.d.ts → lib/widgets/index.ts} +3 -3
- package/lib/widgets/pageHeader/PageHeader.tsx +54 -0
- package/{dist/widgets/pageHeader/index.d.ts → lib/widgets/pageHeader/index.ts} +1 -1
- package/package.json +10 -12
- package/postcss.config.mjs +8 -0
- package/src/App.tsx +9 -0
- package/src/app/providers/RootProvider.tsx +11 -0
- package/src/app/providers/index.ts +1 -0
- package/src/app/providers/model/types.ts +5 -0
- package/src/app/providers/ui/ToasterProvider.tsx +23 -0
- package/src/app/providers/ui/index.ts +1 -0
- package/src/configs/setup.ts +9 -0
- package/src/configs/storybook.config.ts +23 -0
- package/src/main.tsx +10 -0
- package/src/stories/primitives/Accordion.stories.tsx +66 -0
- package/src/stories/primitives/Badge.stories.tsx +28 -0
- package/src/stories/primitives/Breadcrumbs.stories.tsx +29 -0
- package/src/stories/primitives/Button/Button.stories.tsx +149 -0
- package/src/stories/primitives/Button/Button.test.tsx +150 -0
- package/src/stories/primitives/ButtonIcon.stories.tsx +75 -0
- package/src/stories/primitives/CustomLink.stories.tsx +64 -0
- package/src/stories/primitives/Document.stories.tsx +36 -0
- package/src/stories/primitives/Heading.stories.tsx +29 -0
- package/src/stories/primitives/Hint.stories.tsx +82 -0
- package/src/stories/primitives/Icon.stories.tsx +36 -0
- package/src/stories/primitives/Loader.stories.tsx +39 -0
- package/src/stories/primitives/PhoneView.stories.tsx +22 -0
- package/src/stories/primitives/Popover.stories.tsx +41 -0
- package/src/stories/primitives/ProgressBar.stories.tsx +68 -0
- package/src/stories/primitives/Skeleton.stories.tsx +21 -0
- package/src/stories/primitives/Table.stories.tsx +44 -0
- package/src/stories/primitives/TabsSwitcher.stories.tsx +34 -0
- package/src/stories/primitives/formControl/Calendar.stories.tsx +61 -0
- package/src/stories/primitives/formControl/CalendarControl.stories.tsx +39 -0
- package/src/stories/primitives/formControl/CheckboxControl.stories.tsx +64 -0
- package/src/stories/primitives/formControl/DadataInputControl.stories.tsx +83 -0
- package/src/stories/primitives/formControl/FormControlAllFields.stories.tsx +25 -0
- package/src/stories/primitives/formControl/InputControl.stories.tsx +77 -0
- package/src/stories/primitives/formControl/RadioContol.stories.tsx +63 -0
- package/src/stories/primitives/formControl/SelectControl.stories.tsx +117 -0
- package/src/stories/primitives/formControl/SwitchControl.stories.tsx +51 -0
- package/src/stories/primitives/formControl/TextareaControl.stories.tsx +55 -0
- package/src/stories/primitives/formControl/inputControlMask.stories.tsx +69 -0
- package/src/stories/widgets/Advantages.stories.tsx +42 -0
- package/src/stories/widgets/Banner.stories.tsx +40 -0
- package/src/stories/widgets/PageHeader.stories.tsx +33 -0
- package/src/storybookHelpers/actions.tsx +5 -0
- package/src/storybookHelpers/index.ts +2 -0
- package/src/storybookHelpers/reactHookForm/index.ts +3 -0
- package/src/storybookHelpers/reactHookForm/model/mockData.ts +21 -0
- package/src/storybookHelpers/reactHookForm/model/mocks.tsx +71 -0
- package/src/storybookHelpers/reactHookForm/model/types.ts +62 -0
- package/src/storybookHelpers/reactHookForm/ui/StorybookFieldsMapper.tsx +76 -0
- package/src/storybookHelpers/reactHookForm/ui/StorybookFormProvider.tsx +43 -0
- package/src/storybookHelpers/reactHookForm/ui/index.ts +2 -0
- package/src/storybookHelpers/table/utils/defaultValue.ts +51 -0
- package/static/arrows/arrowCircle.svg +18 -0
- package/static/arrows/arrowLink.svg +3 -0
- package/static/arrows/arrowRight.svg +3 -0
- package/static/brandLogos/logoBlack.svg +14 -0
- package/static/brandLogos/logoBusiness.svg +80 -0
- package/static/brandLogos/logoGray.svg +56 -0
- package/static/brandLogos/logoInsurance.svg +124 -0
- package/static/brandLogos/logoMain.svg +14 -0
- package/static/brandLogos/logoWhite.svg +56 -0
- package/static/files/documentFilled.svg +4 -0
- package/static/files/documentOutline.svg +4 -0
- package/static/general/calendar.svg +3 -0
- package/static/general/check.svg +6 -0
- package/static/general/close.svg +12 -0
- package/static/info/warningCircle.svg +5 -0
- package/tailwind.config.ts +9 -0
- package/tsconfig.json +33 -0
- package/tsconfig.node.json +11 -0
- package/vite.config.ts +63 -0
- package/vitest.config.mjs +12 -0
- package/dist/ExampleContainer.d.ts +0 -5
- package/dist/configs/index.d.ts +0 -1
- package/dist/configs/tailwindConfigBase.d.ts +0 -2
- package/dist/index.d.ts +0 -8
- package/dist/shared/constants/api.d.ts +0 -2
- package/dist/shared/constants/designSystem/colors.d.ts +0 -120
- package/dist/shared/constants/designSystem/index.d.ts +0 -3
- package/dist/shared/constants/designSystem/others.d.ts +0 -16
- package/dist/shared/constants/designSystem/typography.d.ts +0 -75
- package/dist/shared/constants/index.d.ts +0 -2
- package/dist/shared/hooks/index.d.ts +0 -4
- package/dist/shared/hooks/useBoolean.d.ts +0 -3
- package/dist/shared/hooks/useClickOutside.d.ts +0 -2
- package/dist/shared/hooks/useControlledForm.d.ts +0 -7
- package/dist/shared/hooks/useDebounce.d.ts +0 -3
- package/dist/shared/ui/Badge.d.ts +0 -6
- package/dist/shared/ui/Breadcrumbs.d.ts +0 -15
- package/dist/shared/ui/ButtonIcon.d.ts +0 -17
- package/dist/shared/ui/CustomLink.d.ts +0 -15
- package/dist/shared/ui/Document.d.ts +0 -13
- package/dist/shared/ui/Heading.d.ts +0 -12
- package/dist/shared/ui/Hint.d.ts +0 -21
- package/dist/shared/ui/Loader.d.ts +0 -21
- package/dist/shared/ui/PhoneView.d.ts +0 -12
- package/dist/shared/ui/Portal.d.ts +0 -7
- package/dist/shared/ui/ProgressBar.d.ts +0 -18
- package/dist/shared/ui/ResponsiveContainer.d.ts +0 -6
- package/dist/shared/ui/Section.d.ts +0 -6
- package/dist/shared/ui/Skeleton.d.ts +0 -4
- package/dist/shared/ui/TabsSwitcher.d.ts +0 -33
- package/dist/shared/ui/accordion/Accordion.d.ts +0 -13
- package/dist/shared/ui/accordion/index.d.ts +0 -1
- package/dist/shared/ui/accordion/model/types.d.ts +0 -17
- package/dist/shared/ui/accordion/ui/AccordionHeader.d.ts +0 -8
- package/dist/shared/ui/brandLogos.d.ts +0 -5
- package/dist/shared/ui/button/Button.d.ts +0 -17
- package/dist/shared/ui/button/index.d.ts +0 -1
- package/dist/shared/ui/button/model/helpers.d.ts +0 -2
- package/dist/shared/ui/calendar/Calendar.d.ts +0 -20
- package/dist/shared/ui/calendar/index.d.ts +0 -1
- package/dist/shared/ui/calendar/model/animation.d.ts +0 -18
- package/dist/shared/ui/calendar/model/classes.d.ts +0 -24
- package/dist/shared/ui/calendar/model/helpers.d.ts +0 -9
- package/dist/shared/ui/calendar/model/hooks/index.d.ts +0 -2
- package/dist/shared/ui/calendar/model/hooks/useCalendarDropdowns.d.ts +0 -9
- package/dist/shared/ui/calendar/model/hooks/useDatePicker.d.ts +0 -19
- package/dist/shared/ui/calendar/ui/CalendarHeader.d.ts +0 -15
- package/dist/shared/ui/calendar/ui/Dropdown.d.ts +0 -10
- package/dist/shared/ui/calendar/ui/NavigationArrows.d.ts +0 -5
- package/dist/shared/ui/calendar/ui/Weekdays.d.ts +0 -1
- package/dist/shared/ui/calendar/ui/index.d.ts +0 -2
- package/dist/shared/ui/formControlElements/CheckboxControl.d.ts +0 -13
- package/dist/shared/ui/formControlElements/FormControl.d.ts +0 -3
- package/dist/shared/ui/formControlElements/InputControl.d.ts +0 -6
- package/dist/shared/ui/formControlElements/InputControlMask.d.ts +0 -10
- package/dist/shared/ui/formControlElements/RadioControl.d.ts +0 -26
- package/dist/shared/ui/formControlElements/SelectControl.d.ts +0 -27
- package/dist/shared/ui/formControlElements/SwitchControl.d.ts +0 -16
- package/dist/shared/ui/formControlElements/TextareaControl.d.ts +0 -11
- package/dist/shared/ui/formControlElements/calendarControl/CalendarControl.d.ts +0 -13
- package/dist/shared/ui/formControlElements/calendarControl/hooks/index.d.ts +0 -2
- package/dist/shared/ui/formControlElements/calendarControl/hooks/useCalendar.d.ts +0 -16
- package/dist/shared/ui/formControlElements/calendarControl/hooks/useCalendarDropdowns.d.ts +0 -9
- package/dist/shared/ui/formControlElements/calendarControl/model/helpers.d.ts +0 -24
- package/dist/shared/ui/formControlElements/calendarControl/model/types.d.ts +0 -33
- package/dist/shared/ui/formControlElements/calendarControl/ui/DaysOfMonth.d.ts +0 -10
- package/dist/shared/ui/formControlElements/calendarControl/ui/DaysOfWeek.d.ts +0 -6
- package/dist/shared/ui/formControlElements/calendarControl/ui/Dropdown.d.ts +0 -11
- package/dist/shared/ui/formControlElements/calendarControl/ui/Header.d.ts +0 -14
- package/dist/shared/ui/formControlElements/calendarControl/ui/Navigation.d.ts +0 -9
- package/dist/shared/ui/formControlElements/calendarControl/ui/OptionsList.d.ts +0 -5
- package/dist/shared/ui/formControlElements/calendarControl/ui/index.d.ts +0 -4
- package/dist/shared/ui/formControlElements/dadata/DadataInputControl.d.ts +0 -14
- package/dist/shared/ui/formControlElements/dadata/model/api.d.ts +0 -2
- package/dist/shared/ui/formControlElements/dadata/model/helpers.d.ts +0 -7
- package/dist/shared/ui/formControlElements/dadata/model/types.d.ts +0 -42
- package/dist/shared/ui/formControlElements/dadata/model/useDadata.d.ts +0 -7
- package/dist/shared/ui/formControlElements/model/classes-types.d.ts +0 -18
- package/dist/shared/ui/formControlElements/model/index.d.ts +0 -2
- package/dist/shared/ui/formControlElements/model/props-types.d.ts +0 -20
- package/dist/shared/ui/formControlElements/ui/FieldAttachment.d.ts +0 -13
- package/dist/shared/ui/formControlElements/ui/FieldContainer.d.ts +0 -14
- package/dist/shared/ui/formControlElements/ui/FieldWrapper.d.ts +0 -14
- package/dist/shared/ui/formControlElements/ui/MessageView.d.ts +0 -13
- package/dist/shared/ui/formControlElements/ui/index.d.ts +0 -4
- package/dist/shared/ui/icon/Icon.d.ts +0 -10
- package/dist/shared/ui/icon/sprite.gen.d.ts +0 -17
- package/dist/shared/ui/index.d.ts +0 -21
- package/dist/shared/ui/popover/Popover.d.ts +0 -23
- package/dist/shared/ui/popover/index.d.ts +0 -1
- package/dist/shared/ui/table/Table.d.ts +0 -17
- package/dist/shared/ui/table/index.d.ts +0 -1
- package/dist/shared/ui/table/type.d.ts +0 -21
- package/dist/shared/utils/capitalize.d.ts +0 -1
- package/dist/shared/utils/cn.d.ts +0 -2
- package/dist/shared/utils/deepCompare.d.ts +0 -1
- package/dist/shared/utils/formatToDate.d.ts +0 -1
- package/dist/shared/utils/index.d.ts +0 -5
- package/dist/shared/utils/isClient.d.ts +0 -1
- package/dist/shared/validation/index.d.ts +0 -3
- package/dist/shared/validation/messages.d.ts +0 -12
- package/dist/shared/validation/regExp.d.ts +0 -3
- package/dist/shared/validation/zodValidation/calendar.d.ts +0 -2
- package/dist/shared/validation/zodValidation/dadataFio.d.ts +0 -6
- package/dist/shared/validation/zodValidation/index.d.ts +0 -2
- package/dist/style.css +0 -1
- package/dist/ui.es.js +0 -25268
- package/dist/ui.umd.js +0 -85
- package/dist/widgets/Advantages.d.ts +0 -17
- package/dist/widgets/banner/Banner.d.ts +0 -28
- package/dist/widgets/banner/index.d.ts +0 -1
- package/dist/widgets/banner/model/helpers.d.ts +0 -4
- package/dist/widgets/banner/ui/BannerButtonsGroup.d.ts +0 -12
- package/dist/widgets/pageHeader/PageHeader.d.ts +0 -16
- /package/{dist → public}/sprites/arrows.svg +0 -0
- /package/{dist → public}/sprites/brandLogos.svg +0 -0
- /package/{dist → public}/sprites/common.svg +0 -0
- /package/{dist → public}/sprites/files.svg +0 -0
- /package/{dist → public}/sprites/general.svg +0 -0
- /package/{dist → public}/sprites/info.svg +0 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { brandLogos, Button, PhoneView, ResponsiveContainer, type TBrandLogoVariant } from '$/shared/ui'
|
|
2
|
+
|
|
3
|
+
export interface ICommonHeaderProps {
|
|
4
|
+
logoPath?: string
|
|
5
|
+
logoType?: TBrandLogoVariant
|
|
6
|
+
}
|
|
7
|
+
interface IHeaderWithPhone extends ICommonHeaderProps {
|
|
8
|
+
variant: 'withPhone'
|
|
9
|
+
phone: string
|
|
10
|
+
phoneText: string
|
|
11
|
+
}
|
|
12
|
+
interface IHeaderWithButton extends ICommonHeaderProps {
|
|
13
|
+
variant: 'withButton'
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type TPageHeaderProps = IHeaderWithButton | IHeaderWithPhone
|
|
17
|
+
|
|
18
|
+
const renderContentVariant = (props: TPageHeaderProps) => {
|
|
19
|
+
switch (props.variant) {
|
|
20
|
+
case 'withButton':
|
|
21
|
+
return (
|
|
22
|
+
<Button intent='secondary' size='sm'>
|
|
23
|
+
Оформить заявку
|
|
24
|
+
</Button>
|
|
25
|
+
)
|
|
26
|
+
case 'withPhone':
|
|
27
|
+
const { phone, phoneText } = props as IHeaderWithPhone
|
|
28
|
+
return <PhoneView phone={phone} text={phoneText} />
|
|
29
|
+
default:
|
|
30
|
+
return null
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const PageHeader = (props: TPageHeaderProps) => {
|
|
35
|
+
const { logoPath = '/', logoType = 'main' } = props
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<header className='bg-color-blue-grey-200 flex items-center justify-center h-[72px] '>
|
|
39
|
+
<ResponsiveContainer>
|
|
40
|
+
<div className='flex items-center justify-between gap-5 '>
|
|
41
|
+
<a
|
|
42
|
+
href={logoPath}
|
|
43
|
+
target='_blank'
|
|
44
|
+
rel='noreferrer'
|
|
45
|
+
className='[&_svg]:w-[192px] [&_svg]:h-[32px] flex items-center justify-center'
|
|
46
|
+
>
|
|
47
|
+
{brandLogos[logoType]}
|
|
48
|
+
</a>
|
|
49
|
+
{renderContentVariant(props)}
|
|
50
|
+
</div>
|
|
51
|
+
</ResponsiveContainer>
|
|
52
|
+
</header>
|
|
53
|
+
)
|
|
54
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { PageHeader, type TPageHeaderProps } from './PageHeader'
|
|
1
|
+
export { PageHeader, type TPageHeaderProps } from './PageHeader'
|
package/package.json
CHANGED
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scbt-ecom/ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.30",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
|
-
"
|
|
7
|
-
"import": "./dist/
|
|
8
|
-
"require": "./dist/
|
|
9
|
-
"types": "./dist/
|
|
6
|
+
"./client": {
|
|
7
|
+
"import": "./dist/esm/client.js",
|
|
8
|
+
"require": "./dist/cjs/client.js",
|
|
9
|
+
"types": "./dist/types/client.d.ts"
|
|
10
10
|
},
|
|
11
|
-
"./
|
|
11
|
+
"./server": {
|
|
12
|
+
"import": "./dist/esm/server.js",
|
|
13
|
+
"require": "./dist/cjs/server.js",
|
|
14
|
+
"types": "./dist/types/server.d.ts"
|
|
15
|
+
}
|
|
12
16
|
},
|
|
13
|
-
"main": "./dist/ui.umd.cjs",
|
|
14
|
-
"module": "./dist/ui.es.js",
|
|
15
|
-
"types": "./dist/index.d.ts",
|
|
16
|
-
"files": [
|
|
17
|
-
"dist"
|
|
18
|
-
],
|
|
19
17
|
"scripts": {
|
|
20
18
|
"dev": "vite",
|
|
21
19
|
"build": "tsc -b && vite build",
|
package/src/App.tsx
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const App = () => {
|
|
2
|
+
return (
|
|
3
|
+
<div className='flex justify-center items-center min-h-screen'>
|
|
4
|
+
<h2 className='text-color-tetriary desk-title-bold-s'>
|
|
5
|
+
use <span className='text-color-primary-default desk-title-bold-s'> npm run start </span> for run storybook
|
|
6
|
+
</h2>
|
|
7
|
+
</div>
|
|
8
|
+
)
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './RootProvider'
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useEffect } from 'react'
|
|
2
|
+
import toast, { Toaster, useToasterStore } from 'react-hot-toast'
|
|
3
|
+
|
|
4
|
+
export const ToasterProvider = () => {
|
|
5
|
+
const { toasts } = useToasterStore()
|
|
6
|
+
const TOAST_LIMIT = 5
|
|
7
|
+
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
toasts
|
|
10
|
+
.filter((t) => t.visible)
|
|
11
|
+
.filter((_, i) => i >= TOAST_LIMIT)
|
|
12
|
+
.forEach((t) => toast.dismiss(t.id))
|
|
13
|
+
}, [toasts])
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<Toaster
|
|
17
|
+
position='top-right'
|
|
18
|
+
toastOptions={{
|
|
19
|
+
duration: 5000
|
|
20
|
+
}}
|
|
21
|
+
/>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ToasterProvider'
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const STORYBOOK_VIEWPORTS = {
|
|
2
|
+
mobile: {
|
|
3
|
+
name: 'mobile',
|
|
4
|
+
styles: {
|
|
5
|
+
width: '360px',
|
|
6
|
+
height: '700px'
|
|
7
|
+
}
|
|
8
|
+
},
|
|
9
|
+
desktop: {
|
|
10
|
+
name: 'desktop',
|
|
11
|
+
styles: {
|
|
12
|
+
width: '1188px',
|
|
13
|
+
height: '700px'
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
fullscreen: {
|
|
17
|
+
name: 'fullscreen',
|
|
18
|
+
styles: {
|
|
19
|
+
width: '100%',
|
|
20
|
+
height: '100%'
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
package/src/main.tsx
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import { Accordion } from '$/shared/ui'
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'INTERACTIVE/Accordion',
|
|
6
|
+
component: Accordion,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
decorators: [
|
|
9
|
+
(Story) => (
|
|
10
|
+
<div className='max-w-[800px] mt-8 m-auto'>
|
|
11
|
+
<Story />
|
|
12
|
+
</div>
|
|
13
|
+
)
|
|
14
|
+
]
|
|
15
|
+
} satisfies Meta<typeof Accordion>
|
|
16
|
+
|
|
17
|
+
export default meta
|
|
18
|
+
|
|
19
|
+
type Story = StoryObj<typeof Accordion>
|
|
20
|
+
|
|
21
|
+
const mock_accordion_list = [
|
|
22
|
+
{
|
|
23
|
+
label: 'Заголовок аккордеон 1',
|
|
24
|
+
content: 'Контент аккордеона 1'
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
label: 'Заголовок аккордеон 2',
|
|
28
|
+
content: 'Контент аккордеона 2'
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
label: 'Заголовок аккордеон 3',
|
|
32
|
+
content: 'Контент аккордеона 3'
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
export const Base: Story = {
|
|
37
|
+
args: {
|
|
38
|
+
label: 'Заголовок аккордеон',
|
|
39
|
+
children: 'Контент аккордеона'
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const WithDefaultOpen: Story = {
|
|
44
|
+
args: {
|
|
45
|
+
defaultOpen: ['Заголовок аккордеон'],
|
|
46
|
+
label: 'Заголовок аккордеон',
|
|
47
|
+
children: 'Контент аккордеона'
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const MappedWithDefaultOpen: Story = {
|
|
52
|
+
render: (...args) => (
|
|
53
|
+
<div className='flex flex-col gap-6'>
|
|
54
|
+
{mock_accordion_list?.map(({ label, content }) => (
|
|
55
|
+
<Accordion
|
|
56
|
+
defaultOpen={['Заголовок аккордеон 1', 'Заголовок аккордеон 2']}
|
|
57
|
+
key={label.toString()}
|
|
58
|
+
label={label}
|
|
59
|
+
{...args}
|
|
60
|
+
>
|
|
61
|
+
{content}
|
|
62
|
+
</Accordion>
|
|
63
|
+
))}
|
|
64
|
+
</div>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import { Badge } from '$/shared/ui'
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Base/Badge',
|
|
6
|
+
component: Badge,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: 'centered'
|
|
9
|
+
},
|
|
10
|
+
tags: ['autodocs']
|
|
11
|
+
} satisfies Meta<typeof Badge>
|
|
12
|
+
|
|
13
|
+
export default meta
|
|
14
|
+
|
|
15
|
+
type Story = StoryObj<typeof meta>
|
|
16
|
+
|
|
17
|
+
export const Base: Story = {
|
|
18
|
+
args: {
|
|
19
|
+
children: 'Text container'
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const MinWidth: Story = {
|
|
24
|
+
args: {
|
|
25
|
+
children: '2',
|
|
26
|
+
className: 'bg-color-primary-default'
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import { Breadcrumbs } from '$/shared/ui'
|
|
3
|
+
import type { TLinksList } from '$/shared/ui/Breadcrumbs'
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Navigation/Breadcrumbs',
|
|
7
|
+
component: Breadcrumbs,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered'
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
tags: ['autodocs']
|
|
13
|
+
} satisfies Meta<typeof Breadcrumbs>
|
|
14
|
+
|
|
15
|
+
export default meta
|
|
16
|
+
|
|
17
|
+
type Story = StoryObj<typeof meta>
|
|
18
|
+
|
|
19
|
+
const linksList: TLinksList = [
|
|
20
|
+
{ label: 'Главная', path: 'https://sovcombank.ru/' },
|
|
21
|
+
{ label: 'Займы', path: 'https://sovcombank.ru/apply/credit/zajm-online/' },
|
|
22
|
+
{ label: 'Главная' }
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
export const Base: Story = {
|
|
26
|
+
args: {
|
|
27
|
+
linksList
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import toast from 'react-hot-toast'
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
3
|
+
import { Button, Icon } from '$/shared/ui'
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'BASE/Button',
|
|
7
|
+
component: Button,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'centered'
|
|
11
|
+
}
|
|
12
|
+
} satisfies Meta<typeof Button>
|
|
13
|
+
|
|
14
|
+
export default meta
|
|
15
|
+
type Story = StoryObj<typeof meta>
|
|
16
|
+
|
|
17
|
+
export const Base: Story = {
|
|
18
|
+
args: {
|
|
19
|
+
size: 'md',
|
|
20
|
+
children: 'Button',
|
|
21
|
+
intent: 'primary',
|
|
22
|
+
textFormat: 'initial',
|
|
23
|
+
isLoading: false,
|
|
24
|
+
onClick: () => toast.success('Clicked')
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const AllVariantsButtons: Story = {
|
|
29
|
+
render: () => (
|
|
30
|
+
<div className='flex flex-col gap-8'>
|
|
31
|
+
<div className='flex flex-col gap-3'>
|
|
32
|
+
<strong className='text-color-tetriary'># Primary</strong>
|
|
33
|
+
<div className='flex items-center gap-5'>
|
|
34
|
+
<Button intent='primary' size='lg'>
|
|
35
|
+
Button
|
|
36
|
+
</Button>
|
|
37
|
+
<Button intent='primary' size='md'>
|
|
38
|
+
Button
|
|
39
|
+
</Button>
|
|
40
|
+
<Button intent='primary' size='sm'>
|
|
41
|
+
Button
|
|
42
|
+
</Button>
|
|
43
|
+
<Button intent='primary' size='sm' disabled>
|
|
44
|
+
Button
|
|
45
|
+
</Button>
|
|
46
|
+
<Button intent='primary' size='sm' isLoading>
|
|
47
|
+
Button
|
|
48
|
+
</Button>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
<div className='flex flex-col gap-3'>
|
|
53
|
+
<strong className='text-color-tetriary'># Secondary</strong>
|
|
54
|
+
<div className='flex items-center gap-5'>
|
|
55
|
+
<Button intent='secondary' size='lg'>
|
|
56
|
+
Button
|
|
57
|
+
</Button>
|
|
58
|
+
<Button intent='secondary' size='md'>
|
|
59
|
+
Button
|
|
60
|
+
</Button>
|
|
61
|
+
<Button intent='secondary' size='sm'>
|
|
62
|
+
Button
|
|
63
|
+
</Button>
|
|
64
|
+
<Button intent='secondary' size='sm' disabled>
|
|
65
|
+
Button
|
|
66
|
+
</Button>
|
|
67
|
+
<Button intent='secondary' size='sm' isLoading>
|
|
68
|
+
Button
|
|
69
|
+
</Button>
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
<div className='flex flex-col gap-3'>
|
|
74
|
+
<strong className='text-color-tetriary'># Ghost</strong>
|
|
75
|
+
<div className='flex items-center gap-5'>
|
|
76
|
+
<Button intent='ghost' size='lg'>
|
|
77
|
+
Button
|
|
78
|
+
</Button>
|
|
79
|
+
<Button intent='ghost' size='md'>
|
|
80
|
+
Button
|
|
81
|
+
</Button>
|
|
82
|
+
<Button intent='ghost' size='sm'>
|
|
83
|
+
Button
|
|
84
|
+
</Button>
|
|
85
|
+
<Button intent='ghost' size='sm' disabled>
|
|
86
|
+
Button
|
|
87
|
+
</Button>
|
|
88
|
+
<Button intent='ghost' size='sm' isLoading>
|
|
89
|
+
Button
|
|
90
|
+
</Button>
|
|
91
|
+
</div>
|
|
92
|
+
</div>
|
|
93
|
+
|
|
94
|
+
<div className='flex flex-col gap-3'>
|
|
95
|
+
<strong className='text-color-tetriary'># Red</strong>
|
|
96
|
+
<div className='flex items-center gap-5'>
|
|
97
|
+
<Button intent='red' size='lg'>
|
|
98
|
+
Button
|
|
99
|
+
</Button>
|
|
100
|
+
<Button intent='red' size='md'>
|
|
101
|
+
Button
|
|
102
|
+
</Button>
|
|
103
|
+
<Button intent='red' size='sm'>
|
|
104
|
+
Button
|
|
105
|
+
</Button>
|
|
106
|
+
<Button intent='red' size='sm' disabled>
|
|
107
|
+
Button
|
|
108
|
+
</Button>
|
|
109
|
+
<Button intent='red' size='sm' isLoading>
|
|
110
|
+
Button
|
|
111
|
+
</Button>
|
|
112
|
+
</div>
|
|
113
|
+
</div>
|
|
114
|
+
|
|
115
|
+
<div className='flex flex-col gap-3'>
|
|
116
|
+
<strong className='text-color-tetriary'># Text format</strong>
|
|
117
|
+
<div className='flex items-center gap-5'>
|
|
118
|
+
<Button intent='primary' size='lg' textFormat='capitalize'>
|
|
119
|
+
capitalize
|
|
120
|
+
</Button>
|
|
121
|
+
<Button intent='primary' size='md' textFormat='uppercase'>
|
|
122
|
+
uppercase
|
|
123
|
+
</Button>
|
|
124
|
+
<Button intent='primary' size='sm' textFormat='lowercase'>
|
|
125
|
+
lowercase
|
|
126
|
+
</Button>
|
|
127
|
+
<Button intent='primary' size='sm' textFormat='initial'>
|
|
128
|
+
initial
|
|
129
|
+
</Button>
|
|
130
|
+
</div>
|
|
131
|
+
</div>
|
|
132
|
+
|
|
133
|
+
<div className='flex flex-col gap-3'>
|
|
134
|
+
<strong className='text-color-tetriary'># With icons</strong>
|
|
135
|
+
<div className='flex items-center gap-5'>
|
|
136
|
+
<Button iconLeft={<Icon name='general/check' />} intent='primary' size='lg'>
|
|
137
|
+
Button
|
|
138
|
+
</Button>
|
|
139
|
+
<Button iconLeft={<Icon name='general/check' />} iconRight={<Icon name='general/check' />} intent='primary' size='md'>
|
|
140
|
+
Button
|
|
141
|
+
</Button>
|
|
142
|
+
<Button iconRight={<Icon name='general/check' />} intent='primary' size='sm'>
|
|
143
|
+
Button
|
|
144
|
+
</Button>
|
|
145
|
+
</div>
|
|
146
|
+
</div>
|
|
147
|
+
</div>
|
|
148
|
+
)
|
|
149
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
// "pre-deploy": "npm run lint && npm run test -- --watch=false" for package json
|
|
2
|
+
|
|
3
|
+
// import { render, screen } from '@testing-library/react'
|
|
4
|
+
// import { describe, expect, it } from 'vitest'
|
|
5
|
+
// import { Button } from '$/shared/ui'
|
|
6
|
+
|
|
7
|
+
// describe('Тестирование Button', () => {
|
|
8
|
+
// const buttonTestid = 'test-button'
|
|
9
|
+
|
|
10
|
+
// it('Кнопка должна рендериться с правильным текстом', () => {
|
|
11
|
+
// const { asFragment } = render(<Button data-testid={buttonTestid}>Click me!</Button>)
|
|
12
|
+
|
|
13
|
+
// expect(asFragment()).toMatchSnapshot()
|
|
14
|
+
|
|
15
|
+
// const button = screen.getByTestId(buttonTestid)
|
|
16
|
+
|
|
17
|
+
// expect(button).toBeInTheDocument()
|
|
18
|
+
// expect(button).toHaveTextContent('Click me!')
|
|
19
|
+
// })
|
|
20
|
+
|
|
21
|
+
// it('Кнопка должна быть отключена, когда свойство disabled равно true', () => {
|
|
22
|
+
// const { asFragment } = render(
|
|
23
|
+
// <Button disabled data-testid={buttonTestid}>
|
|
24
|
+
// Click me!
|
|
25
|
+
// </Button>
|
|
26
|
+
// )
|
|
27
|
+
|
|
28
|
+
// expect(asFragment()).toMatchSnapshot()
|
|
29
|
+
|
|
30
|
+
// const button = screen.getByTestId(buttonTestid)
|
|
31
|
+
|
|
32
|
+
// expect(button).toBeInTheDocument()
|
|
33
|
+
// expect(button).toBeDisabled()
|
|
34
|
+
// })
|
|
35
|
+
|
|
36
|
+
// it('Кнопка должна быть включена, когда свойство disabled равно false', () => {
|
|
37
|
+
// const { asFragment } = render(
|
|
38
|
+
// <Button disabled={false} data-testid={buttonTestid}>
|
|
39
|
+
// Click me!
|
|
40
|
+
// </Button>
|
|
41
|
+
// )
|
|
42
|
+
|
|
43
|
+
// expect(asFragment()).toMatchSnapshot()
|
|
44
|
+
|
|
45
|
+
// const button = screen.getByTestId(buttonTestid)
|
|
46
|
+
|
|
47
|
+
// expect(button).toBeInTheDocument()
|
|
48
|
+
// expect(button).not.toBeDisabled()
|
|
49
|
+
// })
|
|
50
|
+
|
|
51
|
+
// it('Кнопка должна отображать иконку слева до текста, если она передана', () => {
|
|
52
|
+
// const icon = (
|
|
53
|
+
// <span role='img' aria-label='icon'>
|
|
54
|
+
// 🌟
|
|
55
|
+
// </span>
|
|
56
|
+
// )
|
|
57
|
+
|
|
58
|
+
// const { asFragment } = render(
|
|
59
|
+
// <Button data-testid={buttonTestid} iconLeft={icon}>
|
|
60
|
+
// Click me!
|
|
61
|
+
// </Button>
|
|
62
|
+
// )
|
|
63
|
+
|
|
64
|
+
// expect(asFragment()).toMatchSnapshot()
|
|
65
|
+
|
|
66
|
+
// const button = screen.getByTestId(buttonTestid)
|
|
67
|
+
// const iconElement = screen.getByRole('img')
|
|
68
|
+
// const buttonText = screen.getByText('Click me!')
|
|
69
|
+
|
|
70
|
+
// expect(button).toBeInTheDocument()
|
|
71
|
+
// expect(button).toContainElement(iconElement)
|
|
72
|
+
// expect(button).toContainElement(buttonText)
|
|
73
|
+
|
|
74
|
+
// const buttonContent = button.textContent!
|
|
75
|
+
// expect(buttonContent.indexOf('🌟')).toBeLessThan(buttonContent.indexOf('Click me!'))
|
|
76
|
+
// })
|
|
77
|
+
|
|
78
|
+
// it('Кнопка должна отображать иконку справа после текста, если она передана', () => {
|
|
79
|
+
// const icon = (
|
|
80
|
+
// <span role='img' aria-label='icon'>
|
|
81
|
+
// 🌟
|
|
82
|
+
// </span>
|
|
83
|
+
// )
|
|
84
|
+
|
|
85
|
+
// const { asFragment } = render(
|
|
86
|
+
// <Button data-testid={buttonTestid} iconRight={icon}>
|
|
87
|
+
// Click me!
|
|
88
|
+
// </Button>
|
|
89
|
+
// )
|
|
90
|
+
|
|
91
|
+
// expect(asFragment()).toMatchSnapshot()
|
|
92
|
+
|
|
93
|
+
// const button = screen.getByTestId(buttonTestid)
|
|
94
|
+
// const iconElement = screen.getByRole('img')
|
|
95
|
+
// const buttonText = screen.getByText('Click me!')
|
|
96
|
+
|
|
97
|
+
// expect(button).toBeInTheDocument()
|
|
98
|
+
// expect(button).toContainElement(iconElement)
|
|
99
|
+
// expect(button).toContainElement(buttonText)
|
|
100
|
+
|
|
101
|
+
// const buttonContent = button.textContent!
|
|
102
|
+
// expect(buttonContent.indexOf('Click me!')).toBeLessThan(buttonContent.indexOf('🌟'))
|
|
103
|
+
// })
|
|
104
|
+
|
|
105
|
+
// it('На кнопку добавляется новый класс, если передается className', () => {
|
|
106
|
+
// const { asFragment } = render(
|
|
107
|
+
// <Button data-testid={buttonTestid} className='testClassName'>
|
|
108
|
+
// Click me!
|
|
109
|
+
// </Button>
|
|
110
|
+
// )
|
|
111
|
+
|
|
112
|
+
// expect(asFragment()).toMatchSnapshot()
|
|
113
|
+
|
|
114
|
+
// const button = screen.getByTestId(buttonTestid)
|
|
115
|
+
// const buttonClassName = document.querySelector('.testClassName')
|
|
116
|
+
|
|
117
|
+
// expect(button).toBeInTheDocument()
|
|
118
|
+
// expect(buttonClassName).toBeInTheDocument()
|
|
119
|
+
// })
|
|
120
|
+
|
|
121
|
+
// it('Кнопка меняет тип, если передать type', () => {
|
|
122
|
+
// const { asFragment } = render(
|
|
123
|
+
// <Button data-testid={buttonTestid} type='reset'>
|
|
124
|
+
// Click me!
|
|
125
|
+
// </Button>
|
|
126
|
+
// )
|
|
127
|
+
|
|
128
|
+
// expect(asFragment()).toMatchSnapshot()
|
|
129
|
+
|
|
130
|
+
// const button = screen.getByTestId(buttonTestid)
|
|
131
|
+
|
|
132
|
+
// expect(button).toBeInTheDocument()
|
|
133
|
+
// expect(button.getAttribute('type')).toBe('reset')
|
|
134
|
+
// })
|
|
135
|
+
|
|
136
|
+
// it('Кнопка применяет нужные стили при передаче props textFormat', () => {
|
|
137
|
+
// const { asFragment } = render(
|
|
138
|
+
// <Button data-testid={buttonTestid} textFormat='uppercase'>
|
|
139
|
+
// Click me!
|
|
140
|
+
// </Button>
|
|
141
|
+
// )
|
|
142
|
+
|
|
143
|
+
// expect(asFragment()).toMatchSnapshot()
|
|
144
|
+
|
|
145
|
+
// const button = screen.getByTestId(buttonTestid)
|
|
146
|
+
|
|
147
|
+
// expect(button).toBeInTheDocument()
|
|
148
|
+
// expect(button).toHaveClass('uppercase')
|
|
149
|
+
// })
|
|
150
|
+
// })
|