Skip to content

Commit

Permalink
Merge pull request #61 from fs-mar24-codemafia/feat/view-button
Browse files Browse the repository at this point in the history
solution
  • Loading branch information
denyssheremeta authored Jun 16, 2024
2 parents 0ce3c30 + 19c8585 commit c2fb453
Show file tree
Hide file tree
Showing 12 changed files with 52 additions and 38 deletions.
10 changes: 10 additions & 0 deletions public/icons/svg/view-grid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions public/icons/svg/view-list.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions src/components/NewHeader/NewHeader.scss
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ $button-size-tablet: 48px;
left: 0;
right: 0;
height: 100vh;
// width: 100vw;
background-color: var(--page-bg-color);
transform: translateX(100%);
transition: all $effect-duration;
Expand Down Expand Up @@ -197,7 +196,7 @@ $button-size-tablet: 48px;
width: 12px;
border-radius: 50%;
background-color: var(--color-red);
filter: var(--icon-filter); //new
filter: var(--icon-filter);

position: absolute;
bottom: 8px;
Expand Down
2 changes: 1 addition & 1 deletion src/components/OldHeader/Header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
width: 12px;
border-radius: 50%;
background-color: var(--color-red);
filter: var(--icon-filter); //new
filter: var(--icon-filter);

position: absolute;
bottom: 8px;
Expand Down
23 changes: 5 additions & 18 deletions src/pages/CartPage/CartItem/CartItem.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,44 +52,32 @@

&__product-link {
display: flex;
// flex-basis: 25%;
text-decoration: none;

&--name {
// flex-basis: 60%;

@include on-mobile {
// flex-basis: 45%
}
}
}

&__name {
@include body-text;

font-weight: 600;
transition: all $effect-duration;

&:hover {
text-decoration: underline;
}
@include on-mobile {
// flex-basis: 100%;
}
}

&__count-buttons {
// margin-right: 40px;
width: 96px;
height: 32px;
display: grid;
justify-content: space-between;
align-items: center;
// gap: 14px;
flex-direction: column;
grid-template-columns: 1fr 32px 1fr;
justify-items: center;

@include body-text;
}
}

&__button {
min-width: 32px;
Expand All @@ -113,10 +101,9 @@
justify-content: space-between;
align-items: center;
gap: 16px;

@include on-mobile {
width: 100%;
// gap: 16px;
// justify-content: space-between;
}
}
.gadget {
Expand All @@ -127,8 +114,8 @@
justify-content: flex-start;
align-items: center;
gap: 24px;

@include on-mobile {
// width: 100%;
gap: 16px;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/EmptyCart/EmptyCart.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
&__image-wrapper {
display: flex;
justify-content: center;
height: 300px;
height: 250px;
margin-block: 32px;
}

Expand Down
2 changes: 1 addition & 1 deletion src/pages/EmptyFav/EmptyFav.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
&__image-wrapper {
display: flex;
justify-content: center;
height: 300px;
height: 250px;
margin-block: 32px;
}

Expand Down
11 changes: 10 additions & 1 deletion src/pages/ProductsPage/ProductsPage.scss
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,19 @@
@include hover(border, 1px solid #89939a);
@include active(scale, 0.95);

display: flex;
justify-content: center;
align-items: center;
height: 40px;
width: 40px;

height: 40px;
color: var(--color-primary);
background-color: var(--page-bg-color);
border: 1px solid #b4bdc3;
cursor: pointer;
}
&__view-icon {
height: 32px;
width: 32px;
}
}
9 changes: 8 additions & 1 deletion src/pages/ProductsPage/ProductsPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { FC, useEffect, useState } from 'react';
import { useSearchParams } from 'react-router-dom';
import cn from 'classnames';

import { service } from '../../services/getAllProducts';

Expand Down Expand Up @@ -151,9 +152,15 @@ export const ProductsPage: FC<Props> = ({ category }) => {
<div className="products__view-wrp">
<button
className="products__view-btn"
title="Chenge view style"
onClick={() => setListView(!listView)}
>
Change view
<i
className={cn('ico products__view-icon', {
'ico-list': !listView,
'ico-grid': listView,
})}
></i>
</button>
</div>
<div className="products__filter--search">
Expand Down
8 changes: 8 additions & 0 deletions src/styles/utils/_icons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,12 @@
border-color: var(--color-primary);
}
}

&-list {
background-image: url('../../../public/icons/svg/view-list.svg');
}

&-grid {
background-image: url('../../../public/icons/svg/view-grid.svg');
}
}
2 changes: 0 additions & 2 deletions src/styles/utils/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
}

@mixin content-padding-inline {
// padding-inline: 32px;

@include on-tablet {
padding-inline: 24px;
}
Expand Down
11 changes: 0 additions & 11 deletions src/utils/httpClient.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
// const BASE_URL = `api`;

// export function getData<T>(url: string): Promise<T> {
// return fetch(BASE_URL + url).then((response) => {
// if (!response.ok) {
// throw new Error(`${response.status} ${response.text}`);
// }
// return response.json();
// });
// }

const BASE_URL = `api`;

function delay(ms: number): Promise<void> {
Expand Down

0 comments on commit c2fb453

Please sign in to comment.