Skip to content
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

fix: padding in category #166

Merged
merged 28 commits into from
Dec 26, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
9b1f1e4
fix: padding in category
jsapro Dec 22, 2023
4e75d4b
fix: delete package name from counters
jsapro Dec 22, 2023
9a68fb9
fix: error when response body is empty (status 205)
jsapro Dec 22, 2023
f2bd617
fix: make order button disabled in case cart is empty
jsapro Dec 22, 2023
de8d3e1
fix: interface for MakingOrderBtn props
jsapro Dec 23, 2023
c623293
fix: add all className variants to type ButtonProps
jsapro Dec 23, 2023
bfa90c1
feat: implement button adding favourites to cart
jsapro Dec 22, 2023
d2fc67f
feat: add price near cart icon in header
jsapro Dec 22, 2023
a1bb4e7
feat: add price near cart icon in header for not-auth user
jsapro Dec 22, 2023
3679dc9
feat: add CatalogPromo component
jsapro Dec 24, 2023
45ed214
feat: change old catalog component on main page to new one
jsapro Dec 24, 2023
fa76d54
refactor: delete unused code
jsapro Dec 24, 2023
0b7fdea
feat: add title-link for catalog on main page
jsapro Dec 25, 2023
0d42085
feat: add component TitleArrowLink
jsapro Dec 25, 2023
1fee0b1
feat: change Recipe title to new TitleArrowLink component
jsapro Dec 25, 2023
138cb73
feat: change Catalog title to new TitleArrowLink component
jsapro Dec 25, 2023
0e6f26d
fix: change recipe fields according to new responce from server
jsapro Dec 26, 2023
d65e95d
fix: display energy value
jsapro Dec 26, 2023
ededa47
fix: padding in category
jsapro Dec 22, 2023
7116471
fix: delete package name from counters
jsapro Dec 22, 2023
507778c
fix: error when response body is empty (status 205)
jsapro Dec 22, 2023
4a14d3f
fix: make order button disabled in case cart is empty
jsapro Dec 22, 2023
36286bf
fix: interface for MakingOrderBtn props
jsapro Dec 23, 2023
3a97cf4
fix: add all className variants to type ButtonProps
jsapro Dec 23, 2023
8605221
fix: change recipe fields according to new responce from server
jsapro Dec 26, 2023
085917a
fix: (rebase) display energy value
jsapro Dec 26, 2023
b1c465e
merge conflict
jsapro Dec 26, 2023
d666ad7
fix: field value
jsapro Dec 26, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/Button/button.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
transition: 0.5s;

&:disabled {
background-color: black;
cursor: not-allowed;
background-color: $accent-color-lightest-green;
cursor: initial;
}
}

Expand Down
10 changes: 7 additions & 3 deletions src/components/Button/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import clsx from 'clsx';
import styles from './button.module.scss';

type ButtonProps = {
export type ButtonProps = {
buttonText: string;
buttonStyle: string;
classNameActive?: string;
buttonStyle:
| 'green-border-button'
| 'green-border-button__active'
| 'greenish-button'
| 'green-button';
classNameActive?: 'greenish-button__active' | '';
onClick?: () => void;
disabled?: boolean;
classNames?: string;
Expand Down
14 changes: 9 additions & 5 deletions src/components/making-order-btn/index.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import React from 'react';
import styles from './making-order-btn.module.scss';
import Button from '@components/Button';
import type { ButtonProps } from '@components/Button';

interface MakingOrderBtnProps {
onClick?: () => void;
}
interface MakingOrderBtnProps extends Pick<ButtonProps, 'disabled' | 'onClick'> {}

const MakingOrderBtn: React.FC<MakingOrderBtnProps> = ({ onClick }) => {
const MakingOrderBtn: React.FC<MakingOrderBtnProps> = ({ onClick, disabled }) => {
return (
<div className={styles.order}>
<Button buttonText="Оформить заказ" buttonStyle="green-button" onClick={onClick} />
<Button
buttonText="Оформить заказ"
buttonStyle="green-button"
Karmyshkov marked this conversation as resolved.
Show resolved Hide resolved
onClick={onClick}
disabled={disabled}
/>
<p className={`${styles.order__title}`}>
Нажимая на&nbsp;кнопку &laquo;Оформить заказ&raquo;, вы&nbsp;соглашаетесь
с&nbsp;условиями обработки персональных данных, а&nbsp;также с&nbsp;условиями
Expand Down
4 changes: 2 additions & 2 deletions src/components/making-order-btn/making-order-btn.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
transition: 0.5s;

&:disabled {
background-color: black;
cursor: not-allowed;
background-color: $accent-color-lightest-green;
cursor: initial;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const ProductsListPopup: React.FC<RecipeIngredientsProps> = ({ ingredients }) =>
>
<img src={minusIcon} alt="минус" />
</button>
<p className={styles.counter__value}>{`${product.amount_of_pack} уп.`}</p>
<p className={styles.counter__value}>{product.amount_of_pack}</p>
<button
className={styles.counter__button}
onClick={() =>
Expand Down
4 changes: 1 addition & 3 deletions src/components/shopping-item/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ const ShoppingItem: React.FC<ShoppingItemProps> = (props) => {
className={`${styles.item_btn} ${styles.item__decrease_btn}`}
onClick={handleDecreaseClick}
></button>
<p
className={`text_type_u ${styles.item__measure}`}
>{`${product.quantity} шт`}</p>
<p className={`text_type_u ${styles.item__measure}`}>{product.quantity}</p>
<button
className={`${styles.item_btn} ${styles.item__increase_btn}`}
onClick={handleIncreaseClick}
Expand Down
2 changes: 2 additions & 0 deletions src/pages/category/category.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@
.category__sorting {
width: 328px;
margin-right: 20px;
padding-top: 58px;

@media screen and (width <= 768px) {
padding-top: 0;
margin-right: 0;
max-width: 280px;
}
Expand Down
4 changes: 2 additions & 2 deletions src/pages/checkout/checkout.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -513,8 +513,8 @@
transition: 0.5s;

&:disabled {
background-color: black;
cursor: not-allowed;
background-color: $accent-color-lightest-green;
cursor: initial;
}
}

Expand Down
1 change: 1 addition & 0 deletions src/pages/checkout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ const Checkout: React.FC = () => {
!isLoggedIn && !isValid ? `${styles['orderse__buttonStyle_error']}` : ''
}`}
onClick={handleSubmitOrder}
disabled={cartData.products.length === 0}
>
Оформить заказ
</button>
Expand Down
5 changes: 4 additions & 1 deletion src/pages/shopping-cart/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,10 @@ const ShoppingCart: React.FC = () => {
</p>
</div>
</div>
<MakingOrderBtn onClick={handleSubmitOrderClick} />
<MakingOrderBtn
onClick={handleSubmitOrderClick}
disabled={cartData.products.length === 0}
/>
</div>
</div>
)}
Expand Down
2 changes: 1 addition & 1 deletion src/services/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Api {

_checkResponse(res: Response) {
if (res.ok) {
if (res.status === 204) return res;
if (res.status === 204 || res.status === 205) return res;
return res.json();
}

Expand Down
Loading