-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
№222 create form return #240
The head ref may contain hidden characters: "\u2116222-create-form-retur-n"
Changes from all commits
2ff6493
91e373f
744d774
bdc810b
4af2d44
1d7cf03
735a8d2
870953b
db267bf
8ec67b3
9fef814
359e27d
dc307a2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
@use '../../shared/styles/utils/variables' as var; | ||
|
||
.help { | ||
align-self: flex-start; | ||
|
||
&__path { | ||
text-align: left; | ||
margin: 0; | ||
padding: 0; | ||
} | ||
|
||
&__cats { | ||
display: flex; | ||
flex-direction: column; | ||
max-width: 340px; | ||
padding: 40px 30px 65px; | ||
align-items: flex-start; | ||
border-radius: 10px; | ||
background: var.$white; | ||
max-height: 300px; | ||
} | ||
|
||
&__wrapper { | ||
display: flex; | ||
gap: 30px; | ||
} | ||
|
||
&__container { | ||
display: flex; | ||
flex-direction: column; | ||
max-width: 100%; | ||
gap: 30px; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import Heading, { HeadingType } from '@/shared/ui/Heading/Heading' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. порядок импортов не соблюден |
||
import Subheading from '@/shared/ui/Subheading/Subheading' | ||
import FormReturn from '@/widgets/FormReturn/FormReturn' | ||
import HelpCategories from '@/widgets/HelpCategories/HelpCategories' | ||
|
||
import WrapperForMainContent from '../../components/WrapperForMainContent/WrapperForMainContent' | ||
|
||
import styles from './HelpPage.module.scss' | ||
|
||
const HelpPage = () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. здесь тоже оставляем документаци. |
||
return ( | ||
<WrapperForMainContent> | ||
<div className={styles.help__wrapper}> | ||
<div className={styles.help__container}> | ||
<Heading type={HeadingType.NORMAL}>Помощь</Heading> | ||
<Subheading className={styles.help__path}>Главная/Помощь</Subheading> | ||
<div className={styles.help__cats}> | ||
<Heading type={HeadingType.NORMAL}>Категории</Heading> | ||
<HelpCategories /> | ||
</div> | ||
</div> | ||
<div className={styles.help__container}> | ||
<Heading type={HeadingType.NORMAL}>Форма возврата</Heading> | ||
<FormReturn /> | ||
</div> | ||
</div> | ||
</WrapperForMainContent> | ||
) | ||
} | ||
|
||
export default HelpPage |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
@use '../../../shared/styles/utils/variables' as var; | ||
|
||
.formReturn { | ||
&__checkbox { | ||
display: flex; | ||
align-items: center; | ||
cursor: pointer; | ||
|
||
&:first-child { | ||
margin-top: 10px; | ||
} | ||
} | ||
|
||
&__radio { | ||
height: 20px; | ||
width: 20px; | ||
background-color: var.$theme-primary-color; | ||
margin: 10px 15px 10px 0; | ||
border-color: var.$body-color; | ||
cursor: pointer; | ||
accent-color: var.$theme-primary-color; | ||
} | ||
} | ||
|
||
.primary { | ||
accent-color: var.$theme-primary-color; | ||
} | ||
|
||
.medium { | ||
height: 20px; | ||
width: 20px; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { Formik, Form } from 'formik' | ||
import { Meta, StoryObj } from '@storybook/react' | ||
Check failure on line 2 in src/shared/ui/Checkbox/Checkbox.stories.tsx GitHub Actions / pipeline (18.x)
|
||
import Checkbox, { CheckboxProps } from './Checkbox' | ||
import { ECheckboxTheme, ECheckboxSize } from '@/shared/model/types/common' | ||
|
||
export default { | ||
title: 'shared/Checkbox', | ||
component: Checkbox, | ||
decorators: [ | ||
Story => ( | ||
<Formik initialValues={{ myChoice: false }} onSubmit={values => console.log(values)}> | ||
<Form> | ||
<Story /> | ||
</Form> | ||
</Formik> | ||
) | ||
], | ||
parameters: { | ||
layout: 'centered' | ||
}, | ||
argTypes: { | ||
checked: { control: 'boolean' } | ||
} | ||
} as Meta<CheckboxProps> | ||
|
||
const Template: StoryObj<CheckboxProps> = { | ||
render: args => <Checkbox {...args} /> | ||
} | ||
|
||
export const Primary = { | ||
...Template, | ||
args: { | ||
name: 'Text', | ||
value: 'Text', | ||
label: 'Text', | ||
theme: ECheckboxTheme.PRIMARY, | ||
size: ECheckboxSize.M | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { FC } from 'react' | ||
import { Field, useField } from 'formik' | ||
Check failure on line 2 in src/shared/ui/Checkbox/Checkbox.tsx GitHub Actions / pipeline (18.x)
|
||
import style from './Checkbox.module.scss' | ||
import { Input } from '@/shared/ui/Input/Input' | ||
Check failure on line 4 in src/shared/ui/Checkbox/Checkbox.tsx GitHub Actions / pipeline (18.x)
|
||
import classNames from 'classnames' | ||
import { ECheckboxTheme, ECheckboxSize } from '@/shared/model/types/common' | ||
|
||
export interface CheckboxProps { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. из типов в компоненте храним только пропсы There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. не выполнено There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Не понял вопроса. Смотрел как другие сделали, все также. У Артура спросил, тоже не знает) |
||
name: string | ||
value?: string | ||
label?: string | ||
htmlFor: string | ||
theme?: ECheckboxTheme | ||
size?: ECheckboxSize | ||
className?: string | ||
} | ||
|
||
/** | ||
* компонент Button | ||
* @param {string} props.name - имя для привязки к htmlFor | ||
* @param {string} props.value - значение выбранного поля | ||
* @param {string} props.label - название поля | ||
* @param {string} props.htmlFor - для привязки к field | ||
* @param {ECheckboxTheme} props.theme - тема представления | ||
* @param {ECheckboxSize} props.size - размер | ||
*/ | ||
|
||
const Checkbox: FC<CheckboxProps> = props => { | ||
const { | ||
className, | ||
value, | ||
htmlFor, | ||
label, | ||
name, | ||
theme = ECheckboxTheme.PRIMARY, | ||
size = ECheckboxSize.M | ||
} = props | ||
|
||
const additionalClasses = [className, theme && style[theme], style[size]] | ||
|
||
const [field] = useField({ name, type: 'radio', value }) | ||
|
||
return ( | ||
<label className={style.formReturn__checkbox} htmlFor={htmlFor}> | ||
<Field | ||
checked={field.checked} | ||
className={classNames(style.formReturn__radio, additionalClasses)} | ||
as={Input} | ||
label={label} | ||
name={name} | ||
type="radio" | ||
value={value} | ||
/> | ||
<span>{label}</span> | ||
</label> | ||
) | ||
} | ||
|
||
export default Checkbox |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,7 +126,7 @@ export const RightArrow = () => ( | |
<p className="sb-section-item-paragraph">Use stories to test a component in all its variations, no matter how | ||
complex.</p> | ||
<a | ||
href="https://storybook.js.org/docs/react/writing-tests/introduction" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. почему изменена строчка? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Не знаю. Не менял. Может при установке пакета какого нибудь по ошибке. Без понятия... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. А зачем пакет был установлен? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Удалил так как не знаю как это появилось, может команду не ту ввел. Вообщем вернул |
||
href="https://storybook.js.org/docs/react/writing-tests" | ||
target="_blank" | ||
>Learn more<RightArrow /></a> | ||
</div> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
что это за пакет и почему об этом нет ничего в описании