-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
loyout_product_card_reviev #4816
base: master
Are you sure you want to change the base?
Conversation
nikalaiii
commented
Oct 5, 2024
- DEMO LINK
- TEST REPORT LINK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there! 👋 You've made a great effort, but we need to tidy up a few things before we can merge this Pull Request. There are some issues with duplicate variable declarations, incorrect usage of selectors, and redundant properties. Also, make sure to set the base font size correctly and optimize the stars implementation for better efficiency. Keep up the good work, and with a bit of polishing, your code will shine! ✨
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
src/index.html
Outdated
<link | ||
href="https://fonts.googleapis.com/css2?family=Roboto:wght@100;400;500;700&display=swap" | ||
rel="stylesheet" | ||
/> | ||
<title>Product cards</title> | ||
<link | ||
rel="stylesheet" | ||
href="./styles/index.scss" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Link to SCSS file is incorrect. SCSS files are not supported by browsers directly. You should link to the compiled CSS file instead.
src/index.html
Outdated
<div class="card__rating-stars card__rating-stars--1"></div> | ||
<div class="card__rating-stars card__rating-stars--2"></div> | ||
<div class="card__rating-stars card__rating-stars--3"></div> | ||
<div class="card__rating-stars card__rating-stars--4"></div> | ||
<div class="card__rating-stars card__rating-stars--5"></div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way you've implemented stars for rating is not efficient. Consider using a loop in your SCSS to generate the stars, or use a single container with a background image that represents the stars, and control the filled portion with width and background clipping.
src/index.html
Outdated
<a | ||
href="index.html" | ||
class="card__buy-text" | ||
data-qa="hover" | ||
> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anchor tag with 'href' attribute set to 'index.html' will lead to the same page. If this is a placeholder for a future link, consider using '#' or 'javascript:void(0);' for now to make it clear that it's not meant to be a navigable link yet.
html { | ||
font-family: $font-family; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the Code Style Rules, the base font size should be set in the html
selector using px
units. Make sure that the $font-family
variable is defined with a fallback system font, e.g., Helvetica, Arial, sans-serif
.
width: 198px; | ||
height: 406px; | ||
|
||
&__content { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid setting the same width and height for an element and its BEM element. If .card
has a set width and height, the &__content
should not repeat those properties unless it is intentionally different.
background-repeat: no-repeat; | ||
margin-left: 19px; | ||
margin-top: 32px; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The background-position
, background-size
, and background-repeat
properties are redundant here since they are already included in the flex-center
mixin. It's better to keep the code DRY (Don't Repeat Yourself) by not repeating these properties.
src/styles/index.scss
Outdated
margin-top: 16px; | ||
|
||
// Цикл для зірок | ||
@for $i from 1 through $stars-count { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The loop for generating stars should be applied to a list of elements rather than applying styles to the &-stars
class. Ensure that the HTML has multiple elements with the class &__rating-star
to apply this loop correctly.
src/styles/index.scss
Outdated
@for $i from 1 through $stars-count { | ||
&-stars:nth-child(#{$i}) { | ||
// Перевіряємо, чи це остання зірка | ||
@if $i < $stars-count { | ||
background-image: url(../images/star-active.svg); | ||
} @else { | ||
background-image: url(../images/star.svg); | ||
} | ||
|
||
@include star-position; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The nth-child
selector is being used incorrectly. It should be applied to child elements of a parent container and not to the &-stars
modifier itself. Make sure that the HTML structure matches this SCSS logic.
src/styles/variables.scss
Outdated
$font-family: 'Roboto', sans-serif; | ||
$border-color: white; | ||
$border-radius: 5px; | ||
$star-size: 16px; | ||
$buy-button-font-size: 14px; | ||
$buy-button-font-weight: 700; | ||
$stars-count: 5; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are duplicate variable declarations in this file. The variables $font-family
, $border-color
, $border-radius
, $star-size
, $buy-button-font-size
, $buy-button-font-weight
, and $stars-count
are defined twice with the same values. According to the Code Style Rules ❗️, you should avoid code duplication. Please remove the duplicate variable declarations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job on your project! The HTML structure is well-formed, and your SCSS/CSS is well organized. Just remember to validate your HTML and make sure to manage your dimensions and colors through variables for better maintainability. Keep up the good work! 🌟
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
<!doctype html> | ||
<html lang="en"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The <!DOCTYPE html>
declaration should be in lowercase to adhere to the HTML5 specification and maintain consistency with the code style guide.
/> | ||
<link | ||
rel="preconnect" | ||
href="https://fonts.gstatic.com" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The preconnect
to fonts.gstatic.com is unnecessary if you're using fonts.googleapis.com, as the latter should implicitly handle the connection to the font service.
<title>Product cards</title> | ||
<link | ||
rel="stylesheet" | ||
href="./styles/index.scss" | ||
href="./styles/styles.css" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the checklist, the project should not contain unused files. If 'styles.css' is a compiled file from SCSS, it should not be included directly in the HTML, but rather served through a build process to ensure the latest styles are applied.
class="card" | ||
data-qa="card" | ||
> | ||
<div class="card__content"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The div
element with class card__content
could be replaced with a more semantic element such as article
or section
to better represent the content within a card.
<div class="card__image"></div> | ||
|
||
<div class="card__title"> | ||
<p class="card__title-text"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The p
element inside card__title
is unnecessary if it only contains text. You can apply the card__title-text
class directly to the div
element to reduce HTML complexity.
.card__content { | ||
width: 198px; | ||
height: 406px; | ||
border-radius: 5px; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The .card__content
class has the same fixed width and height as .card
. If .card__content
is meant to be the same size as .card
, it's better to use inheritance or relative units instead of redeclaring the same dimensions.
margin-left: 19px; | ||
margin-top: 32px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The margin-left
and margin-top
for .card__image
can be replaced with more flexible solutions like flexbox alignment or padding on the parent element.
.card__rating-stars:nth-child(1) { | ||
background-image: url(../images/star-active.svg); | ||
width: 16px; | ||
height: 16px; | ||
margin-left: 4px; | ||
background-position: center; | ||
background-repeat: no-repeat; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The styles for .card__rating-stars
are repeated with only the background-image
changing for the last child. Consider using a general class for shared styles and a modifier class to change the background image for the inactive star.
.card__price { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
width: 166px; | ||
height: 16px; | ||
margin-top: 24px; | ||
margin-left: 16px; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The .card__price
has a fixed width which may not be flexible. Consider using max-width or percentages for width to maintain flexibility.
.card__buy { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
width: 166px; | ||
height: 40px; | ||
margin-top: 16px; | ||
margin-left: 16px; | ||
background-color: #00acdc; | ||
border: 1px solid #00acdc; | ||
border-radius: 5px; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The .card__buy
button has fixed dimensions which can lead to content overflow if the text is too long. Use padding instead of fixed height for better text accommodation and consider min-width for better responsiveness.