Skip to content

Commit

Permalink
Merge pull request #393 from Studio-Yandex-Practicum/enhancement_381_…
Browse files Browse the repository at this point in the history
…favorite_page

Enhancement 381 favorite page
  • Loading branch information
kirill-k88 authored May 21, 2024
2 parents 403a902 + f5fbbd2 commit 7c27885
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 61 deletions.
53 changes: 32 additions & 21 deletions src/pages/FavoritesPage/FavoritesPage.module.scss
Original file line number Diff line number Diff line change
@@ -1,28 +1,39 @@
@use '../../shared/styles/utils/mixins' as media;
@use '../../shared/styles/utils/variables' as color;

.pageDescriptor {
width: 100%;
display: flex;
flex-direction: column;
gap: 10px;
}

.favoritePage__container {
width: 100%;
display: flex;
justify-content: start;
align-items: start;
gap: 10px;

@include media.respond-to('middle') {
.favoritePage {
&__pageDescriptor {
width: 100%;
display: flex;
flex-direction: column;
gap: 10px;
}
}

.favoritePage__list {
max-width: calc(292px * 3 + 60px);
display: flex;
flex-wrap: wrap;
gap: 30px;
&__container {
width: 100%;
display: flex;
justify-content: start;
align-items: start;
gap: 10px;

@include media.respond-to('middle') {
flex-direction: column;
gap: 10px;
}
}

&__list {
max-width: calc(292px * 3 + 60px);
display: flex;
flex-wrap: wrap;
gap: 30px;
}

&__span {
font-size: 15px;
line-height: 1.5;
font-weight: 400;
color: color.$black;
margin-left: 20px;
}
}
86 changes: 46 additions & 40 deletions src/pages/FavoritesPage/FavoritesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,46 +52,52 @@ export const FavoritesPage: FC = () => {
}

return (
<WrapperForMainContent>
<div className={styles.pageDescriptor}>
<Heading>Избранные товары</Heading>
<Breadcrumbs links={links} />
</div>
<div className={styles.favoritePage__container}>
{isScreenMd ? (
<SideBarMenu user={user} handleLogOut={handleLogOut} />
) : (
<SideBarButton onClick={handleClick} />
<div className={styles.favoritePage}>
<WrapperForMainContent>
<div className={styles.favoritePage__pageDescriptor}>
<Heading>Избранные товары</Heading>
<Breadcrumbs links={links} />
</div>
<div className={styles.favoritePage__container}>
{isScreenMd ? (
<SideBarMenu user={user} handleLogOut={handleLogOut} />
) : (
<SideBarButton onClick={handleClick} />
)}
{favoriteProducts.length > 0 ? (
<section className={styles.favoritePage__list}>
<ProductsList
items={{
category_name: '',
count: favoriteProducts.length,
next: '',
previous: '',
results: favoriteProducts
}}
cardView={ECardView.GRID}
/>
</section>
) : (
<span className={styles.favoritePage__span}>Ваши закладки пусты</span>
)}
</div>
{isModalOpen && (
<Modal
isModalOpen={isModalOpen}
onClose={changeModalState}
isModalClosing={isModalClosing}
setIsModalClosing={setIsModalClosing}>
<Suspense fallback={<Spinner />}>
<SideBarMenuModal
handleClose={changeModalState}
onKeyUp={handleKeyUp}
handleLogOut={handleLogOut}
user={user}
/>
</Suspense>
</Modal>
)}
<section className={styles.favoritePage__list}>
<ProductsList
items={{
category_name: '',
count: favoriteProducts.length,
next: '',
previous: '',
results: favoriteProducts
}}
cardView={ECardView.GRID}
/>
</section>
</div>
{isModalOpen && (
<Modal
isModalOpen={isModalOpen}
onClose={changeModalState}
isModalClosing={isModalClosing}
setIsModalClosing={setIsModalClosing}>
<Suspense fallback={<Spinner />}>
<SideBarMenuModal
handleClose={changeModalState}
onKeyUp={handleKeyUp}
handleLogOut={handleLogOut}
user={user}
/>
</Suspense>
</Modal>
)}
</WrapperForMainContent>
</WrapperForMainContent>
</div>
)
}

0 comments on commit 7c27885

Please sign in to comment.