-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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 #5287
base: master
Are you sure you want to change the base?
add task solution #5287
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 |
---|---|---|
|
@@ -7,12 +7,64 @@ | |
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" | ||
/> | ||
<link | ||
href="https://fonts.googleapis.com/css2?family=Roboto:wdth,[email protected],100..900&display=swap" | ||
rel="stylesheet" | ||
/> | ||
<link | ||
rel="stylesheet" | ||
href="./styles/index.scss" | ||
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 task requires separating BEM blocks into individual SCSS files. Currently, the |
||
/> | ||
</head> | ||
<body> | ||
<h1>Product cards</h1> | ||
<div | ||
class="card" | ||
data-qa="card" | ||
> | ||
<img | ||
class="card__img" | ||
src="../src/images/imac.jpeg" | ||
alt="iMac" | ||
/> | ||
|
||
<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__review"> | ||
<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>Reviews: 5</p> | ||
</div> | ||
|
||
<div class="card__price"> | ||
<p class="card__price-label">Price:</p> | ||
<p class="card__price-value">$2,199</p> | ||
</div> | ||
|
||
<a | ||
class="button" | ||
data-qa="hover" | ||
> | ||
BUY | ||
</a> | ||
</div> | ||
</body> | ||
</html> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
.card { | ||
width: 200px; | ||
|
||
padding: 0 16px; | ||
border-radius: 5px; | ||
border: 1px solid #f3f3f3; | ||
Comment on lines
+2
to
+6
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. Consider using SCSS variables for main values like width, padding, border-radius, and border color. This will make your styles more maintainable and consistent. |
||
} | ||
|
||
.card__img { | ||
display: block; | ||
margin: 32px auto 40px; | ||
width: 160px; | ||
height: 134px; | ||
} | ||
|
||
.card__name { | ||
font-weight: 500; | ||
font-size: 12px; | ||
line-height: 18px; | ||
color: #060b35; | ||
margin-bottom: 4px; | ||
} | ||
|
||
.card__code { | ||
font-weight: 400; | ||
font-size: 10px; | ||
line-height: 14px; | ||
color: #616070; | ||
} | ||
|
||
.card__review { | ||
display: flex; | ||
|
||
font-size: 10px; | ||
font-weight: 400; | ||
|
||
align-items: center; | ||
justify-content: space-between; | ||
margin: 16px 0 0; | ||
} | ||
|
||
.card__price { | ||
display: flex; | ||
justify-content: space-between; | ||
margin: 24px 0 16px; | ||
} | ||
|
||
.card__price-label { | ||
font-weight: 400; | ||
font-size: 12px; | ||
line-height: 18px; | ||
color: #616070; | ||
} | ||
|
||
.card__price-value { | ||
font-weight: 700; | ||
font-size: 16px; | ||
line-height: 18px; | ||
color: #060b35; | ||
} | ||
|
||
.button { | ||
display: block; | ||
height: 40px; | ||
align-items: center; | ||
text-align: center; | ||
background-color: #00acdc; | ||
border-radius: 5px; | ||
border: 1px solid transparent; | ||
padding: 12px 0; | ||
margin: 16px 0; | ||
|
||
color: #fff; | ||
font-weight: 700; | ||
font-size: 14px; | ||
line-height: 16px; | ||
text-transform: uppercase; | ||
} | ||
|
||
.button:hover { | ||
border-radius: 5px; | ||
border: 1px solid #00acdc; | ||
background-color: #fff; | ||
color: #00acdc; | ||
Comment on lines
+67
to
+84
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. Using SCSS variables for colors and other repeated values can help maintain consistency and make future changes easier. |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
body, | ||
div, | ||
p, | ||
h2, | ||
a { | ||
margin: 0; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
.stars { | ||
display: flex; | ||
align-items: center; | ||
} | ||
|
||
.stars__star { | ||
height: 16px; | ||
width: 16px; | ||
margin: 0 2px; | ||
background-repeat: no-repeat; | ||
background-position: center; | ||
background-image: url(../images/star.svg); | ||
Comment on lines
+7
to
+12
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. Consider using SCSS variables for repeated values such as height, width, and image paths. This will make your styles more maintainable and consistent. |
||
} | ||
|
||
.stars__star:last-child { | ||
margin-right: 0; | ||
} | ||
|
||
.stars__star:first-child { | ||
margin-left: 0; | ||
} | ||
|
||
.stars--5 > .stars__star, | ||
.stars--1 > .stars__star:nth-child(1), | ||
.stars--2 > .stars__star:nth-child(-n + 2), | ||
.stars--3 > .stars__star:nth-child(-n + 3), | ||
.stars--4 > .stars__star:nth-child(-n + 4) { | ||
background-image: url(../images/star-active.svg); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
* { | ||
box-sizing: border-box; | ||
} | ||
|
||
html { | ||
font-family: Roboto, sans-serif; | ||
font-size: 12px; | ||
font-weight: 500; | ||
Comment on lines
+6
to
+8
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. Consider using SCSS variables for font properties like |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
body { | ||
margin: 0; | ||
} | ||
@import 'blocks/card'; | ||
@import 'blocks/stars'; | ||
@import 'blocks/style'; | ||
@import 'blocks/reset'; |
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
href
attribute is linking to an SCSS file (index.scss
). Ensure that your build process (e.g., Parcel) is correctly configured to handle SCSS files and compile them into CSS. If not, this link might not apply the styles as expected in the browser.