Skip to content

Commit

Permalink
Merge pull request #16 from fe-apr24-team2/main
Browse files Browse the repository at this point in the history
fix issue with colors select
  • Loading branch information
lesdyman authored Aug 5, 2024
2 parents 758311f + 877d6d4 commit 7195272
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 23 deletions.
24 changes: 1 addition & 23 deletions src/Pages/BaseLayout/BaseLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,6 @@ export const BaseLayout = () => {
getProduct();
}, [location, getProduct]);

const activeColor = () => {
const currentColor = location.pathname.split('-');
return currentColor
.filter(
(_el, index) => index === currentColor.length - 1
|| index === currentColor.length - 2,
)
.join(' ');
};

const activeCapacity = () => {
const currentCapacity = location.pathname.split('-');

Expand All @@ -118,18 +108,6 @@ export const BaseLayout = () => {
window.location.href = '#/phones';
};

// const redirectByColor = (color: string) => {
// const pathSegments = location.pathname.split('/');
// if (gadget?.color) {
// pathSegments[pathSegments.length - 1] = pathSegments[
// pathSegments.length - 1
// ].replace(gadget.color, color);
// const newPath = pathSegments.join('/');
// navigate(newPath);
// window.location.reload();
// }
// };

const redirectByColor = (color: string) => {
navigate(
`${gadget?.namespaceId}-${gadget?.capacity.toLowerCase()}-${color.replace(' ', '-')}`,
Expand Down Expand Up @@ -187,7 +165,7 @@ export const BaseLayout = () => {
<div className="colors">
{gadget?.colorsAvailable.map((color) => (
<div
className={`color ${color.replace(' ', '')} ${activeColor().includes(color) ? 'activeColor' : ''}`}
className={`color ${color.replace(' ', '')} ${color === gadget.color ? 'activeColor' : ''}`}
key={color}
onClick={() => redirectByColor(color)}
style={{ cursor: 'pointer' }}
Expand Down
1 change: 1 addition & 0 deletions src/Pages/HomePage/HomePage.scss
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
&__title-h2 {
font-size: 32px;
line-height: 41px;
margin: 24px;

@include on-phone {
font-size: 22px;
Expand Down

0 comments on commit 7195272

Please sign in to comment.