-
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
add task solution #4820
base: master
Are you sure you want to change the base?
add task solution #4820
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,10 +9,61 @@ | |
<title>Product cards</title> | ||
<link | ||
rel="stylesheet" | ||
href="./styles/index.scss" | ||
href="./styles/index.css" | ||
/> | ||
<link | ||
rel="preconnect" | ||
href="https://fonts.googleapis.com" | ||
/> | ||
<link | ||
rel="preconnect" | ||
href="https://fonts.gstatic.com" | ||
/> | ||
<link | ||
href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;0,500;0,700;1,400&display=swap" | ||
rel="stylesheet" | ||
/> | ||
</head> | ||
<body> | ||
<h1>Product cards</h1> | ||
<div | ||
class="product-card" | ||
data-qa="card" | ||
> | ||
<div class="product-card__image"></div> | ||
|
||
<div class="product-card__content"> | ||
<p class="product-name"> | ||
APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A) | ||
</p> | ||
|
||
<div class="product-code">Product code: 195434</div> | ||
|
||
<div class="product-rating"> | ||
<div class="stars"> | ||
<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="product-rating__reviews">Reviews: 5</p> | ||
</div> | ||
|
||
<div class="product-price"> | ||
<p class="product-price__text">Price:</p> | ||
<p class="product-price__value">$2,199</p> | ||
</div> | ||
|
||
<a | ||
href="#" | ||
class="buy-button" | ||
role="button" | ||
data-qa="hover" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
> | ||
Buy | ||
</a> | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,134 @@ | ||
$border-color: #f3f3f3; | ||
$product-card-width: 200px; | ||
$main-fonts: 'Roboto'; | ||
$main-text-color: #060b35; | ||
$second-text-color: #616070; | ||
$button-color: #00acdc; | ||
$border-radius: 5px; | ||
|
||
body { | ||
margin: 0; | ||
} | ||
|
||
.product-card { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
box-sizing: border-box; | ||
width: $product-card-width; | ||
border: 1px solid $border-color; | ||
border-radius: $border-radius; | ||
|
||
&__image { | ||
background-image: url('../images/imac.jpeg'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. According to the checklist, images should be in the format of .png, .jpg, or .jpeg. The image 'imac.jpeg' should be checked to ensure it is in the correct format and renamed if necessary to adhere to the format guidelines. |
||
background-repeat: no-repeat; | ||
background-size: 100% 100%; | ||
width: 160px; | ||
height: 134px; | ||
margin: 32px 19px 0; | ||
box-sizing: border-box; | ||
} | ||
Comment on lines
+23
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The BEM element '.product-card__image' has a margin with non-zero values, which is not recommended. BEM methodology suggests avoiding external geometry and positioning for BEM blocks and elements, such as margins. Consider refactoring this by utilizing the parent element to control the layout instead. |
||
|
||
&__content { | ||
margin: 40px 16px 16px; | ||
font-family: $main-fonts, sans-serif; | ||
} | ||
} | ||
|
||
.product-name { | ||
font-weight: 500; | ||
font-size: 12px; | ||
line-height: 18px; | ||
color: $main-text-color; | ||
margin: 0; | ||
} | ||
|
||
.product-code { | ||
font-weight: 400; | ||
font-size: 10px; | ||
line-height: 14px; | ||
color: $second-text-color; | ||
margin: 4px 0 0; | ||
} | ||
|
||
.product-rating { | ||
margin: 16px 0 0; | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: space-between; | ||
align-items: flex-end; | ||
|
||
&__reviews { | ||
font-weight: 400; | ||
font-size: 10px; | ||
line-height: 14px; | ||
color: $main-text-color; | ||
margin: 0; | ||
} | ||
} | ||
|
||
.stars { | ||
flex-direction: row; | ||
display: flex; | ||
gap: 4px; | ||
|
||
&__star { | ||
background-image: url('../images/star-yellow.svg'); | ||
background-repeat: no-repeat; | ||
background-position: center; | ||
width: 16px; | ||
height: 16px; | ||
|
||
&:last-of-type { | ||
background-image: url('../images/star.svg'); | ||
} | ||
} | ||
} | ||
|
||
.product-price { | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: space-between; | ||
margin: 24px 0 0; | ||
|
||
&__text { | ||
line-height: 18px; | ||
font-weight: 400; | ||
font-size: 12px; | ||
color: $second-text-color; | ||
margin: 0; | ||
} | ||
|
||
&__value { | ||
line-height: 18px; | ||
font-weight: 700; | ||
font-size: 16px; | ||
color: $main-text-color; | ||
margin: 0; | ||
} | ||
} | ||
|
||
.buy-button { | ||
box-sizing: border-box; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
background-color: $button-color; | ||
text-decoration: none; | ||
text-transform: uppercase; | ||
color: #ffff; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The color value should be written in lowercase to maintain consistency as per the code style rules. |
||
font-weight: 700; | ||
font-size: 14px; | ||
line-height: 16px; | ||
margin: 16px 0 0; | ||
border-radius: $border-radius; | ||
border: 1px solid $button-color; | ||
width: 166px; | ||
height: 40px; | ||
|
||
&:hover { | ||
color: $button-color; | ||
background-color: #ffff; | ||
} | ||
} |
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.
For the product code, it is more semantically correct to use a
<span>
tag since this is a short piece of information within a block. Change<div class="product-code">
to<span class="product-code">
.