-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
add task solution #4667
add task solution #4667
Conversation
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 effort on the structure and organization of your SCSS files! 👏 However, before approving, we need to address a few critical issues to ensure the functionality and maintainability of your code:
- Update the paths used for linking resources and images to be relative and correctly enclosed in quotes. This will ensure that your resources load correctly on all platforms.
- Implement the DRY principle to avoid code repetition, which will make your codebase more maintainable in the long run.
- Correct the use of CSS properties, such as
align-items
andtransform
, to ensure that your styles work as intended across all browsers. - Refactor code to use variables for repetitive values and ensure adherence to the code style rules, like using kebab-case for variable names and including a generic font family as a fallback.
Once these changes are made, your code will be in great shape! Keep up the good work, and remember to test your paths and styles across different browsers to catch any compatibility issues. 🛠️💻
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
src/index.html
Outdated
class="header__logo" | ||
> | ||
<img | ||
src="/src/images/logo.png" |
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 using absolute paths for images, use relative paths instead. This ensures that the image can be accessed regardless of the domain or directory structure.
class="card" | ||
> | ||
<img | ||
src="./images/imac.jpeg" |
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 src attribute should use a relative path, not a path that looks like it's absolute. Use './images/imac.jpeg' instead of '/src/images/imac.jpeg'.
src/index.html
Outdated
|
||
<div class="card"> | ||
<img | ||
src="/src/images/imac.jpeg" |
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 src attribute should use a relative path, not a path that looks like it's absolute. Use './images/imac.jpeg' instead of '/src/images/imac.jpeg'.
<div | ||
data-qa="card" | ||
class="card" | ||
> | ||
<img | ||
src="./images/imac.jpeg" | ||
alt="product" | ||
class="card__image" | ||
/> | ||
|
||
<h2 class="card__name"> | ||
APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A) | ||
</h2> | ||
|
||
<p class="card__code">Product code: 195434</p> | ||
|
||
<div class="card__rates"> | ||
<div class="stars stars--4"> | ||
<div class="stars__star"></div> | ||
<div class="stars__star"></div> | ||
<div class="stars__star"></div> | ||
<div class="stars__star"></div> | ||
<div class="stars__star"></div> | ||
</div> | ||
|
||
<p class="card__rates-reviews">Reviews: 5</p> | ||
</div> | ||
|
||
<div class="card__price"> | ||
<p class="card__price-text">Price:</p> | ||
|
||
<p class="card__price-cost">$2,199</p> | ||
</div> | ||
|
||
<button | ||
class="card__button" | ||
data-qa="card-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.
Repeated code: The card component is repeated multiple times with the same content. Consider using a loop to generate these cards if you are using a templating engine or a front-end framework. If you are not using a templating engine, at least ensure that the content is unique for each card if they are meant to be different.
src/styles/blocks/card.scss
Outdated
border: 1px solid $main-card-border-color; | ||
border-radius: 5px; | ||
padding: 32px 16px 16px; | ||
transition: scale 0.3s; |
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 CSS property for transitions should be transform
instead of scale
. Replace scale
with transform
to fix the transition effect.
src/styles/blocks/page.scss
Outdated
@@ -0,0 +1,10 @@ | |||
html { | |||
font-family: Roboto, serif; |
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 ❗️, font-families should be listed with fallbacks. It's a good practice to include a generic font family as a fallback. In this case, 'sans-serif' should be used instead of 'serif' as 'Roboto' is a sans-serif font.
src/styles/blocks/stars.scss
Outdated
@for $i from 1 through 5 { | ||
&--#{$i} &__star:nth-child(-n + #{$i}) { | ||
background-image: url(../images/star-active.svg); | ||
} | ||
} |
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 ❗️, when using SCSS loops, it's recommended to include a newline after the opening brace {
and before the closing brace }
to improve readability.
src/styles/blocks/stars.scss
Outdated
} | ||
|
||
&__star { | ||
background-image: url(../images/star.svg); |
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 paths to the images should be enclosed in quotes according to the code style rules.
src/styles/blocks/stars.scss
Outdated
|
||
@for $i from 1 through 5 { | ||
&--#{$i} &__star:nth-child(-n + #{$i}) { | ||
background-image: url(../images/star-active.svg); |
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 paths to the images should be enclosed in quotes according to the code style rules.
src/styles/blocks/stars.scss
Outdated
width: 16px; | ||
height: 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.
It's better to store repetitive values such as the width and height of the stars in variables for easier maintenance and to avoid magic numbers. Consider adding them to src/styles/utils/variables.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.
src/index.html
Outdated
<nav class="header__navigation navigation"> | ||
<ul class="navigation__list"> | ||
<li class="navigation__item"> | ||
<a | ||
class="navigation__link is-active" |
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.
<nav class="header__navigation navigation"> | |
<ul class="navigation__list"> | |
<li class="navigation__item"> | |
<a | |
class="navigation__link is-active" | |
<nav class="nav"> | |
<ul class="na__list"> | |
<li class="nav__item"> | |
<a | |
class="nav__link is-active" |
src/index.html
Outdated
</li> | ||
<li class="navigation__item"> |
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.
Add the blank line between the links
</li> | |
<li class="navigation__item"> | |
</li> | |
<li class="navigation__item"> |
src/styles/blocks/card.scss
Outdated
transition: scale 0.3s; | ||
|
||
&:hover { | ||
scale: 1.2; |
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.
font-size: 12px; | ||
font-weight: 500; | ||
line-height: 18px; | ||
letter-spacing: 0%; |
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.
And here
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 work! Consider deploying the page and fixing AI comments
|
||
.is-active::after { | ||
content: ''; | ||
width: 37px; |
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.
width: 37px; | |
width: 100%; |
❗️ Copy this
Checklist
to thePull Request
description after links, and put- [x]
before each point after you checked it.:hover
are smooth