Skip to content

Commit

Permalink
fix search params, table view in 320px res
Browse files Browse the repository at this point in the history
  • Loading branch information
denyssheremeta committed Jun 17, 2024
1 parent 7278903 commit 0614d36
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 60 deletions.
24 changes: 18 additions & 6 deletions src/components/ProductCardHorizontal/ProductCardHorizontal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
&__top-wrapper {
display: flex;
justify-content: space-between;
gap: 3px;
}

&__link {
Expand All @@ -35,8 +36,7 @@
}

@include on-mobile {
width: 80px;
height: 110px;
width: 65px;
}
}

Expand All @@ -48,17 +48,16 @@
}

&__title {
font-size: 16px;
font-size: 14px;
font-weight: 600;
padding-top: 8px;
color: var(--color-primary);
height: 40px;
overflow: hidden;
text-overflow: ellipsis;
}

&__prices {
font-size: 18px;
font-size: 16px;
position: relative;
margin-top: 8px;

Expand Down Expand Up @@ -99,7 +98,7 @@
}

&__param {
font-size: 12px;
font-size: 10px;
color: var(--color-secondary);
line-height: 15px;
font-weight: 600;
Expand All @@ -116,5 +115,18 @@
width: 100%;
display: flex;
gap: 8px;

@include on-mobile {
& > .add-to-cart {
font-size: 10px;
}

& > .add-to-cart {
width: 45px;
}
& > .add-to-fav {
width: 25px;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ export const ProductCardHorizontal: FC<Props> = ({ product }) => {
<p className="productCardHorizontal__value">{ram}</p>
</div>
</div>
{/* <div className="productCardHorizontal__buttons">
<AddToCartButton product={product} />
<AddToFavButton product={product} />
</div> */}
</div>
</article>
);
Expand Down
6 changes: 3 additions & 3 deletions src/contexts/ThemeContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ interface ThemeProviderProps {

export const ThemeProvider: React.FC<ThemeProviderProps> = ({ children }) => {
const [theme, setTheme] = useState<Theme>(() => {
const savedTheme = localStorage.getItem('theme');
const savedTheme = localStorage.getItem('data-theme');
return savedTheme ? (savedTheme as Theme) : 'light';
});

useEffect(() => {
const html = document.querySelector('html') as HTMLHtmlElement;
html.setAttribute('theme', theme);
localStorage.setItem('theme', theme);
html.setAttribute('data-theme', theme);
localStorage.setItem('data-theme', theme);
}, [theme]);

const toggleTheme = () => {
Expand Down
9 changes: 8 additions & 1 deletion src/pages/ProductsPage/ProductsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,14 @@ export const ProductsPage: FC<Props> = ({ category }) => {

const handleSearchChange = (event: React.ChangeEvent<HTMLInputElement>) => {
const params = new URLSearchParams(searchParams);
params.set('search', event.target.value.trimStart());
const query = event.target.value.trimStart();

if (query) {
params.set('search', query);
} else {
params.delete('search');
}

params.set('page', String(1));
setSearchParams(params);
};
Expand Down
4 changes: 2 additions & 2 deletions src/styles/utils/_theme-set.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
:root,
[theme='light'] {
[data-theme='light'] {
// design color
--page-bg-color: #fff;
--color-primary: #313237;
Expand Down Expand Up @@ -57,7 +57,7 @@
--pagin-button-border: var(--color-icons);
}

[theme='dark'] {
[data-theme='dark'] {
//design color
--page-bg-color: #0f1121;
--color-primary: #f1f2f9;
Expand Down
44 changes: 0 additions & 44 deletions src/utils/searchHelper.ts

This file was deleted.

0 comments on commit 0614d36

Please sign in to comment.