-
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 #4821
base: master
Are you sure you want to change the base?
add task solution #4821
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 |
---|---|---|
|
@@ -2,17 +2,90 @@ | |
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
|
||
<meta | ||
name="viewport" | ||
content="width=device-width, initial-scale=1.0" | ||
/> | ||
|
||
<title>Product cards</title> | ||
|
||
<link | ||
rel="preconnect" | ||
href="https://fonts.googleapis.com" | ||
/> | ||
|
||
<link | ||
rel="preconnect" | ||
href="https://fonts.gstatic.com" | ||
crossorigin="anonymous" | ||
/> | ||
|
||
<link | ||
href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap" | ||
rel="stylesheet" | ||
/> | ||
|
||
<link | ||
rel="stylesheet" | ||
href="./styles/index.scss" | ||
/> | ||
</head> | ||
|
||
<body> | ||
<h1>Product cards</h1> | ||
<section | ||
class="card" | ||
data-qa="card" | ||
> | ||
<div class="card__image"> | ||
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 naming convention suggests that elements of a block should be named using |
||
<img | ||
class="card__image-photo" | ||
src="images/imac.jpeg" | ||
alt="product photo" | ||
/> | ||
</div> | ||
|
||
<h2 class="card__model"> | ||
APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A) | ||
</h2> | ||
|
||
<div class="card__product-code"> | ||
<p class="card__product-code-style">Product code: 195434</p> | ||
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 |
||
</div> | ||
|
||
<div class="card__grade"> | ||
<div class="card__grade-stars"> | ||
<ul class="card__grade-stars-list"> | ||
<li class="card__grade-stars-list-1"></li> | ||
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 naming convention suggests that elements should not be named with numbers at the end. Instead, use a modifier if necessary. For example, |
||
|
||
<li class="card__grade-stars-list-2"></li> | ||
|
||
<li class="card__grade-stars-list-3"></li> | ||
|
||
<li class="card__grade-stars-list-4"></li> | ||
|
||
<li class="card__grade-stars-list-5"></li> | ||
</ul> | ||
</div> | ||
|
||
<div class="card__grade-reviews">Reviews: 5</div> | ||
</div> | ||
Comment on lines
+56
to
+72
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 rating and reviews could be better represented using |
||
|
||
<div class="card__price"> | ||
<p class="card__price-style">Price:</p> | ||
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. Similar to the previous comment, the |
||
|
||
<p class="card__price-amount-style">$2,199</p> | ||
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 |
||
</div> | ||
|
||
<div class="card__buy"> | ||
<button | ||
class="card__buy-button" | ||
type="button" | ||
data-qa="hover" | ||
> | ||
BUY | ||
</button> | ||
</div> | ||
</section> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,134 @@ | ||
body { | ||
.card { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
box-sizing: border-box; | ||
margin: 0; | ||
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. It is better to set |
||
padding: 0; | ||
width: 200px; | ||
height: 408px; | ||
font-family: Roboto, sans-serif; | ||
Comment on lines
+8
to
+9
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. Avoid using fixed widths and heights for elements. This can make the design less responsive and harder to maintain. Consider using max-width or min-width for width, and padding or min-height for height, to allow for more flexibility. |
||
font-weight: 400; | ||
|
||
&__image { | ||
margin-top: 33px; | ||
|
||
&-photo { | ||
max-width: 160px; | ||
max-height: 134px; | ||
object-fit: contain; | ||
} | ||
} | ||
Comment on lines
+13
to
+20
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 BEM methodology, an element should not be nested inside another element. Here, |
||
|
||
&__model { | ||
margin-top: 40px; | ||
width: 166px; | ||
height: 36px; | ||
font-size: 12px; | ||
Comment on lines
+25
to
+26
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. Fixed width and height on text containers can lead to text overflow or clipping issues. Use padding along with min-height or min-width as needed, and ensure text has enough room to scale with different screen sizes or font settings. |
||
font-weight: 500; | ||
padding-top: 0; | ||
color: #060b35; | ||
} | ||
|
||
&__product-code { | ||
margin-top: 4px; | ||
align-self: start; | ||
width: 98px; | ||
height: 14px; | ||
|
||
&-style { | ||
white-space: nowrap; | ||
padding-left: 17px; | ||
font-size: 10px; | ||
line-height: 14px; | ||
color: #616070; | ||
margin: 0; | ||
} | ||
} | ||
|
||
&__grade { | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: space-between; | ||
width: 166px; | ||
height: 16px; | ||
margin-top: 16px; | ||
|
||
&-stars { | ||
box-sizing: border-box; | ||
width: 96px; | ||
height: 16px; | ||
|
||
&-list { | ||
list-style: none; | ||
justify-content: space-between; | ||
margin: 1px; | ||
|
||
&:nth-child(n + 1) { | ||
background-image: url(../images/star.png); | ||
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 |
||
width: 14px; | ||
height: 14px; | ||
} | ||
|
||
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 use of |
||
&-5 { | ||
visibility: hidden; | ||
} | ||
} | ||
Comment on lines
+73
to
+75
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. Setting an element to |
||
} | ||
|
||
&-reviews { | ||
min-width: 53px; | ||
height: 16px; | ||
line-height: 16px; | ||
font-size: 10px; | ||
color: #060b35; | ||
} | ||
} | ||
|
||
&__price { | ||
display: flex; | ||
justify-content: space-between; | ||
width: 166px; | ||
height: 18px; | ||
margin-top: 24px; | ||
|
||
&-style { | ||
display: block; | ||
min-width: 31px; | ||
height: 18px; | ||
font-size: 12px; | ||
line-height: 18px; | ||
margin: 0; | ||
color: #616070; | ||
} | ||
|
||
&-amount-style { | ||
margin: 0; | ||
width: 50px; | ||
height: 18px; | ||
font-size: 16px; | ||
font-weight: 700; | ||
line-height: 18px; | ||
color: #060b35; | ||
} | ||
} | ||
|
||
&__buy-button { | ||
width: 166px; | ||
height: 40px; | ||
border-radius: 5px; | ||
border-color: inherit; | ||
background-color: #00acdc; | ||
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 property 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 |
||
margin-top: 16px; | ||
font-size: 14px; | ||
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 |
||
font-weight: 700; | ||
line-height: 16px; | ||
text-align: center; | ||
color: #fff; | ||
|
||
&:hover { | ||
color: #00acdc; | ||
background-color: #fff; | ||
} | ||
} | ||
} |
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, attribute
crossorigin
should be used with thelink
tag only when it is necessary. In this case, it seems redundant as the Google Fonts API does not require CORS for font serving.