Skip to content
Open
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
418 changes: 415 additions & 3 deletions src/index.html

Large diffs are not rendered by default.

104 changes: 104 additions & 0 deletions src/styles/blocks/card.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
@use '../utils/variables';

.card {
display: flex;
flex-direction: column;
box-sizing: border-box;

width: variables.$card-width;
padding: variables.$main-padding;
border: 1px solid variables.$border-color;
border-radius: 5px;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checklist item #2 violation: The transition duration is hardcoded as 300ms instead of using the $transition-duration variable defined in variables.scss. This should be transition: all variables.$transition-duration;

transition: all variables.$transition-duration;
color: variables.$main-text-color;

&:hover {
transform: scale(1.2);
}

&__image-container {
width: 160px;
height: 134px;
padding-block: 16px;
align-self: center;
}

&__image {
width: 100%;
height: 100%;
background-color: white;
}

&__title {
margin-top: variables.$secondary-padding;
}

&:hover &__title {
color: variables.$hover-text-color;
}

&__secondary-tytle {
font-weight: 400;
font-size: 10px;
line-height: 14px;
color: variables.$secondary-text-color;
margin-top: 4px;
}

&__reviews {
display: flex;
justify-content: space-between;
align-items: center;

font-weight: 400;
font-size: 10px;
line-height: 14px;
margin-top: variables.$main-padding;
}

&__price-row {
display: flex;
justify-content: space-between;
margin-top: variables.$secondary-padding;
}

&__price-label {
font-weight: 400;
font-size: 12px;
line-height: 18px;
color: variables.$secondary-text-color;
}

&__price-value {
font-weight: 700;
font-size: 16px;
line-height: 18px;
}

&__buy-button {
box-sizing: border-box;
place-self: center;
width: 166px;
height: 40px;

background-color: variables.$main-color;
color: white;

border: 1px solid variables.$main-color;
border-radius: 5px;

font-family: Roboto, sans-serif;
text-transform: uppercase;
font-weight: 700;
font-size: 14px;
line-height: 16px;

margin-top: variables.$main-padding;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checklist item #2 violation: Same hardcoded transition duration - should use variables.$transition-duration instead of 300ms for consistency with the rest of the codebase.

transition: all variables.$transition-duration;

&:hover {
background-color: white;
color: variables.$main-color;
}
}
}
26 changes: 26 additions & 0 deletions src/styles/blocks/catalog.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
@use '../utils/variables.scss';

.catalog {
--grid-columns: 1;

display: grid;
grid-template-columns: repeat(var(--grid-columns), variables.$card-width);
place-items: center;
justify-content: center;
gap: 46px 48px;
overflow: hidden;

padding: 50px 40px;

@media (min-width: 488px) {
--grid-columns: 2;
}

@media (min-width: 768px) {
--grid-columns: 3;
}

@media (min-width: 1024px) {
--grid-columns: 4;
}
}
18 changes: 18 additions & 0 deletions src/styles/blocks/header.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.header {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
box-shadow: 0 2px 4px 0 #0000000d;

&__logo-link {
display: flex;
height: 40px;
width: 40px;
margin: 0 50px;
}

&__nav {
margin-right: 50px;
Comment on lines +14 to +16

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This violates checklist item #4 ('Cards are shown in 1, 2, 3, or 4 columns based on screen resolution - neighboring cards should not be affected'). Using transform: scale(1.2) without overflow: hidden on the parent container causes the scaled card to push neighboring cards out of their grid positions. Add overflow: hidden to the catalog container or use a different approach.

}
}
53 changes: 53 additions & 0 deletions src/styles/blocks/nav.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
@use '../utils/variables';

.nav {
display: flex;
text-transform: uppercase;

&__list {
display: flex;
list-style: none;
margin: 0;
padding: 0;
}

&__item {
position: relative;
display: flex;

&:not(:last-child) {
margin-right: 20px;
}
}

&__link {
display: flex;
align-items: center;
text-decoration: none;
color: variables.$nav-link-color;
height: variables.$nav-height;
transition: color variables.$transition-duration;

&:hover {
color: variables.$main-color;
cursor: pointer;
text-decoration: none;
}

&.is-active {
color: variables.$main-color;

&::after {
position: absolute;
content: '';
height: 4px;
width: 100%;
bottom: 0;
background-color: variables.$main-color;
border-radius: 8px;
}
}

}
Comment on lines +50 to +51

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .is-active class is defined outside the .nav block, which violates BEM methodology (checklist item #1). In proper BEM, modifiers should be nested within the block: either use &__link.is-active { } inside .nav, or restructure to follow BEM conventions properly.

}

10 changes: 10 additions & 0 deletions src/styles/blocks/page.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.page {
font-family: Roboto, sans-serif;
font-weight: 500;
font-size: 12px;
line-height: 18px;

&__body {
margin: 0;
}
}
24 changes: 24 additions & 0 deletions src/styles/blocks/stars.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.stars {
display: flex;

&__star {
width: 16px;
height: 16px;
margin-right: 4px;
background-image: url(../images/star.svg);
background-repeat: no-repeat;
background-position: center;

&:last-child {
margin-right: 0;
}
}

Comment on lines +14 to +16

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checklist item #4 violation (Cards are shown in 1, 2, 3, or 4 columns based on screen resolution - neighboring cards should not be affected): The card hover uses transform: scale(1.2) without overflow: hidden on the parent container. Since cards are 200px wide, scaling to 240px will cause the card to visually overlap neighboring cards in the grid. Add overflow: hidden to .catalog or use a different approach to ensure neighboring cards are not affected.

&--1 &__star:nth-child(-n + 1),
&--2 &__star:nth-child(-n + 2),
&--3 &__star:nth-child(-n + 3),
&--4 &__star:nth-child(-n + 4),
&--5 &__star:nth-child(-n + 5) {
background-image: url(../images/star-active.svg);
}
}
9 changes: 6 additions & 3 deletions src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
body {
margin: 0;
}
@use './blocks/page';
@use './blocks/header';
@use './blocks/nav';
@use './blocks/catalog';
@use './blocks/stars';
@use './blocks/card';
11 changes: 11 additions & 0 deletions src/styles/utils/variables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
$transition-duration: 0.3s;
$nav-height: 60px;
$nav-link-color: #060b35;
$main-color: #00acdc;
$card-width: 200px;
$border-color: #f3f3f3;
$main-text-color: #060b35;
$secondary-text-color: #616070;
$hover-text-color: #34568b;
$main-padding: 16px;
$secondary-padding: 24px;
Loading