-
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
Development 291 add to cart #321
Conversation
…ь логику для кнопок добавления в корзину
…rontend into development_291_add-to-cart
…rontend into development_291_add-to-cart
…ки. Изменил настройки сборки в webpack, увеличил размер файлов в бандле, поскольку файлы в проекте большие и иначе не собирается.
… Чуть исправил стили для адаптивности верстки.
…rontend into development_291_add-to-cart
…rontend into development_291_add-to-cart
Merge branch 'master' of github.com:Studio-Yandex-Practicum/maxboom_frontend into development_291_add-to-cart
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.
Селекторы + переиспользуемый хук
…rontend into development_291_add-to-cart
…rontend into development_291_add-to-cart
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.
Отличная работа, почти все готово, давай вынесем еще функции добавления в корзину в хук
const [showPopup, setShowPopup] = useState<boolean>(false) | ||
|
||
const addThisToCart = () => { |
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.
гляди, ты вынес в хук useEffect, но так же повторяются функции addThisToCart и handleAddToCart, их тоже можно объявить в хуке и вернуть из него.
В кастомных хуках так же можно использовать useNavigate, useDispatch и тд.
src/widgets/Product/Product.tsx
Outdated
const [showPopup, setShowPopup] = useState<boolean>(false) | ||
|
||
const addThisToCart = () => { |
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.
тоже выносим функции по добавлению в корзину в хук
@@ -24,6 +29,7 @@ type Props = { | |||
slug: string | |||
images: TImgList | |||
quantity: number | |||
id: number |
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.
если добавляешь новый пропс в типы, не забывай обновлять документацию у компонента
const [isModalOpen, setIsModalOpen] = useState(false) | ||
const [isModalClosing, setIsModalClosing] = useState(false) | ||
|
||
const addThisToCart = () => { |
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.
эти функции тоже в хук
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.
👍
…rontend into development_291_add-to-cart
Подключил к кнопка добавления в корзину API и маршрутизацию на страницу корзины.
Немного подправил стили.