Skip to content

Commit

Permalink
Merge pull request #392 from Studio-Yandex-Practicum/enhancement_377_…
Browse files Browse the repository at this point in the history
…login_form_adaptive_new

enhancement_377_login_form_adaptive_new
  • Loading branch information
AlexanderMorugin authored May 21, 2024
2 parents e8a1516 + 1b98ec4 commit 18adcf3
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 18 deletions.
6 changes: 3 additions & 3 deletions src/components/WrapperForMainContent/wrapper.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
max-width: 1470px;
width: 100%;
margin: 0 auto;
padding: 24px;
padding: 25px;
display: flex;
flex-direction: column;
align-items: center;
gap: 48px;
gap: 20px;

@include media.respond-to('middle') {
max-width: 768px;
width: 100%;
width: 100%;
}

@include media.respond-to('small') {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use '@/shared/styles/utils/variables' as var;

.customButtonsContainer {
display: flex;
justify-content: end;
Expand All @@ -24,4 +26,10 @@
width: 25px;
height: 20px;
}

&__iconCart {
fill: var.$white;
width: 25px;
height: 20px;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const WidgetButtonsPurchase: FC<TWidgetButtonsPurchase> = ({
theme={isInCart ? ButtonTheme.SUCCESS : ButtonTheme.PRIMARY}
size={size}
onClick={handleAddToCart}>
<IconCart className={styles.customButton__svg} />
<IconCart className={styles.customButton__iconCart} />
{isInCart ? 'Перейти в корзину' : 'Купить'}
</Button>
<Button
Expand Down
28 changes: 19 additions & 9 deletions src/features/login/ui/LoginForm/LoginForm.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
display: flex;
flex-direction: column;
justify-content: center;
gap: 16px;
margin: 0 auto;
margin-left: 25px;
margin-right: 25px;
background-color: var.$white;
padding: 32px 24px 42px;
width: 450px;
padding: 30px;
width: 100%;
max-width: 450px;
border-radius: 10px;

& .errorForm {
Expand All @@ -22,18 +23,24 @@
}
}

.heading {
padding-bottom: 20px;
}

.span {
color: var.$promo-color;
font-weight: 100;
}

.label {
position: relative;
font-size: 14px;
}

.input {
margin: 12px 0 24px;
padding: 12px;
margin-top: 10px;
margin-bottom: 20px;
padding: 10px 16px;
border-radius: 10px;
background-color: var.$body-bg;
border: 1px solid var.$border-color;
Expand All @@ -45,10 +52,9 @@

.error {
position: absolute;
top: 80px;
left: 0;
top: 67px;
left: 15px;
font-size: 12px;
font-weight: 100;
color: var.$promo-color;
}

Expand Down Expand Up @@ -81,3 +87,7 @@
fill: var.$header-color;
}
}

.link {
margin-bottom: 20px;
}
25 changes: 25 additions & 0 deletions src/features/login/ui/LoginForm/LoginForm.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import type { Meta, StoryObj } from '@storybook/react'

import LoginForm from './LoginForm'

const meta = {
title: 'features/LoginForm',
component: LoginForm,
parameters: {
layout: 'centered'
},
tags: ['autodocs']
} satisfies Meta<typeof LoginForm>

export default meta
type Story = StoryObj<typeof meta>

export const Default: Story = () => {
return (
<div style={{ width: '500px', height: '500px' }}>
<LoginForm isModalOpen={true} handleClose={() => {}} />
</div>
)
}

Default.args = {}
10 changes: 7 additions & 3 deletions src/features/login/ui/LoginForm/LoginForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import IconClose from '@/assets/icons/iconHeaderMenuClose.svg'
import { getErrorAuthStatus } from '@/features/login/model/selectors/getUserAuthStatus'
import { useAppDispatch } from '@/shared/libs/hooks/store'
import { Button, ButtonSize, ButtonTheme } from '@/shared/ui/Button/Button'
import Heading from '@/shared/ui/Heading/Heading'
import Heading, { HeadingType } from '@/shared/ui/Heading/Heading'
import { Input } from '@/shared/ui/Input/Input'
import Link from '@/shared/ui/Link/Link'
import Paragraph, { ParagraphTheme } from '@/shared/ui/Paragraph/Paragraph'
Expand Down Expand Up @@ -58,7 +58,9 @@ const LoginForm: FC<LoginFormProps> = ({ isModalOpen, handleClose, onLogin }) =>
<IconClose className={styles.closeIcon} />
</Button>
)}
<Heading>Авторизация</Heading>
<Heading type={HeadingType.NORMAL} className={styles.heading}>
Авторизация
</Heading>
<label htmlFor="email" className={styles.label}>
Электронная почта
<Field
Expand All @@ -82,7 +84,9 @@ const LoginForm: FC<LoginFormProps> = ({ isModalOpen, handleClose, onLogin }) =>
/>
<ErrorMessage name="password" component="div" className={styles.error} />
</label>
<Link to="#">Забыли пароль?</Link>
<Link to="#" className={styles.link}>
Забыли пароль?
</Link>
<div className={styles.buttons}>
<Button
size={ButtonSize.S}
Expand Down
4 changes: 4 additions & 0 deletions src/widgets/Product/Product.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,8 @@
min-width: 80px;
}
}

&__icon {
fill: var.$white;
}
}
2 changes: 1 addition & 1 deletion src/widgets/Product/Product.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const Product: FC<TProductProps> = ({ product }) => {
size={ButtonSize.S}
onClick={handleAddToCart}>
{isInCart ? 'Перейти в корзину' : 'Купить'}
<IconCart />
<IconCart className={styles.product__icon} />
</Button>
<Button
className={styles.product__btnquick}
Expand Down
4 changes: 4 additions & 0 deletions src/widgets/ProductItem/CardPreview/CardPreview.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,7 @@
height: 20px;
}
}

.icon {
fill: var.$white;
}
2 changes: 1 addition & 1 deletion src/widgets/ProductItem/CardPreview/CardPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export const CardPreview: FC<Props> = ({
onClick={handleAddToCart}
className={styles.customButton}>
{isInCart ? 'Перейти в корзину' : 'Купить'}
<IconCart />
<IconCart className={styles.icon} />
</Button>
<Button theme={ButtonTheme.SECONDARY} size={ButtonSize.S} onClick={handleQuickPurchase}>
Быстрый заказ
Expand Down

0 comments on commit 18adcf3

Please sign in to comment.