-
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 #4847
base: master
Are you sure you want to change the base?
add task solution #4847
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 |
---|---|---|
@@ -1,18 +1,88 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<html | ||
lang="en" | ||
class="page" | ||
> | ||
<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" | ||
/> | ||
|
||
<link | ||
href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" | ||
rel="stylesheet" | ||
/> | ||
|
||
<link | ||
rel="shortcut icon" | ||
href="/src/images/star-active.svg" | ||
type="image/x-icon" | ||
/> | ||
|
||
<link | ||
rel="stylesheet" | ||
href="./styles/index.scss" | ||
/> | ||
<link | ||
rel="stylesheet" | ||
href="./styles/index.scss" | ||
/> | ||
</head> | ||
<body> | ||
<h1>Product cards</h1> | ||
|
||
<body class="page__body"> | ||
<div | ||
class="product-card" | ||
data-qa="card" | ||
> | ||
<div class="product-card__image"> | ||
<img | ||
src="images/imac.jpeg" | ||
alt="APPLE A1419 iMac 27" | ||
/> | ||
</div> | ||
|
||
<div class="product-card__info"> | ||
<h3 class="product-card__title"> | ||
APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A) | ||
</h3> | ||
<p class="product-card__code">Product code: 195434</p> | ||
|
||
<div class="product-card__reviews"> | ||
<div class="product-card__stars"> | ||
<div class="product-card__star"></div> | ||
<div class="product-card__star"></div> | ||
<div class="product-card__star"></div> | ||
<div class="product-card__star"></div> | ||
<div class="product-card__star"></div> | ||
</div> | ||
<span class="product-card__count">Reviews: 5</span> | ||
</div> | ||
|
||
<div class="product-card__price"> | ||
<span class="product-card__label">Price:</span> | ||
<span class="product-card__value">$2,199</span> | ||
</div> | ||
|
||
<button | ||
class="product-card__button product-card__button--hover" | ||
data-qa="hover" | ||
> | ||
Buy | ||
</button> | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.roboto-regular { | ||
font-family: Roboto, sans-serif; | ||
font-weight: 400; | ||
font-style: normal; | ||
} | ||
|
||
.roboto-medium { | ||
font-family: Roboto, sans-serif; | ||
font-weight: 500; | ||
font-style: normal; | ||
} | ||
|
||
.roboto-bold { | ||
font-family: Roboto, sans-serif; | ||
font-weight: 700; | ||
font-style: normal; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.page { | ||
font-family: Roboto, Arial, sans-serif; | ||
font-weight: 400; | ||
|
||
&__body { | ||
margin: 0; | ||
height: 100vh; | ||
|
||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
.product-card { | ||
width: 200px; | ||
height: 408px; | ||
padding: 32px 16px 16px; | ||
|
||
border-radius: 5px; | ||
border: 1px solid rgba(243, 243, 243, 1); | ||
box-sizing: border-box; | ||
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. You have specified |
||
|
||
display: flex; | ||
flex-direction: column; | ||
justify-content: space-between; | ||
|
||
&__image { | ||
padding-inline: 3px; | ||
|
||
& img { | ||
width: 100%; | ||
height: 134px; | ||
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's not recommended to set the height of the image. This can lead to distortion if the aspect ratio of the original image is not the same as the one you've set. It's better to set only the width and let the height be set automatically to maintain the aspect ratio of the image. |
||
} | ||
} | ||
|
||
&__title { | ||
margin: 0; | ||
font-family: inherit; | ||
font-size: 12px; | ||
font-weight: 500; | ||
line-height: 18px; | ||
color: $color-main; | ||
} | ||
|
||
&__code { | ||
margin: 4px 0 16px; | ||
font-family: inherit; | ||
font-size: 10px; | ||
line-height: 14px; | ||
color: rgba(97, 96, 112, 1); | ||
} | ||
|
||
&__reviews { | ||
display: flex; | ||
justify-content: space-between; | ||
} | ||
|
||
&__stars { | ||
display: flex; | ||
} | ||
|
||
&__star { | ||
background-image: url(/src/images/star.svg); | ||
background-position: center; | ||
background-repeat: no-repeat; | ||
width: 16px; | ||
height: 16px; | ||
margin-right: 4px; | ||
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 |
||
} | ||
|
||
&__star:nth-child(-n + 4) { | ||
background-image: url('/src/images/star-active.svg'); | ||
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. This selector |
||
} | ||
|
||
&__count { | ||
font-family: inherit; | ||
font-weight: 400; | ||
font-size: 10px; | ||
line-height: 14px; | ||
align-self: end; | ||
color: $color-main; | ||
} | ||
|
||
&__price { | ||
display: flex; | ||
justify-content: space-between; | ||
margin: 24px 0 16px; | ||
} | ||
|
||
&__label { | ||
font-family: inherit; | ||
font-size: 12px; | ||
line-height: 18px; | ||
color: rgba(97, 96, 112, 1); | ||
} | ||
|
||
&__value { | ||
font-family: inherit; | ||
font-weight: 700; | ||
font-size: 16px; | ||
line-height: 18px; | ||
color: $color-main; | ||
} | ||
|
||
&__button { | ||
height: 40px; | ||
width: 100%; | ||
border: none; | ||
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 the width to 100% could cause layout issues if the parent container's padding, border, or margin is not accounted for. It might be better to use |
||
border-radius: 5px; | ||
background-color: $color-button; | ||
cursor: pointer; | ||
|
||
font-family: inherit; | ||
font-weight: 700; | ||
font-size: 14px; | ||
line-height: 16px; | ||
text-transform: uppercase; | ||
color: rgba(255, 255, 255, 1); | ||
|
||
&:hover { | ||
background-color: #fff; | ||
border: 1px solid $color-button; | ||
color: $color-button; | ||
} | ||
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. On hover, the button text color changes to |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
.stars { | ||
display: flex; | ||
|
||
&__star { | ||
background-image: url(/src/images/star.svg); | ||
background-position: center; | ||
background-repeat: no-repeat; | ||
width: 16px; | ||
height: 16px; | ||
margin-right: 4px; | ||
} | ||
|
||
&__star:nth-child(-n + 4) { | ||
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. This code will always make the first 4 stars active, no matter how many stars you want to be active. You should add a modifier to the stars block, like 'stars--4', and then use it in combination with the nth-child selector to select the appropriate number of active stars. For example, '.stars--4 &__star:nth-child(-n + 4)'. |
||
background-image: url('/src/images/star-active.svg'); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
body { | ||
margin: 0; | ||
} | ||
|
||
@import './utils/variables'; | ||
@import './blocks/font'; | ||
@import './blocks/page'; | ||
@import './blocks/product-card'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
$color-main: rgba(6, 11, 53, 1); | ||
$color-button: rgba(0, 172, 220, 1); |
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.
You have two identical links to the
index.scss
file. Please, remove one of them.