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

Enhancement 381 favorite page #393

Merged
merged 2 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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>
)
}
Loading