Skip to content
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 #5121

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ This is possible because [we use the Parcel library](https://en.parceljs.org/scs

❗️ Replace `<your_account>` with your GitHub username and copy the links to the `Pull Request` description:

- [DEMO LINK](https://<your_account>.github.io/layout_product-cards/)
- [TEST REPORT LINK](https://<your_account>.github.io/layout_product-cards/report/html_report/)
- [DEMO LINK](https://BabaYoga23.github.io/layout_product-cards/)
- [TEST REPORT LINK](https://BabaYoga23.github.io/layout_product-cards/report/html_report/)

❗️ Copy this `Checklist` to the `Pull Request` description after links, and put `- [x]` before each point after you checked it.

Expand Down
55 changes: 54 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- #region HEAD -->
<!doctype html>
<html lang="en">
<head>
Expand All @@ -7,12 +8,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:wght@400;500;700&display=swap"
rel="stylesheet"
/>
<link
rel="stylesheet"
href="./styles/index.scss"
/>
</head>
<!-- #endregion HEAD -->

<body>
<h1>Product cards</h1>
<div
class="card"
data-qa="card"
>
<div class="card__product">
<img
class="card__product-img"
src="./images/imac.jpeg"
alt="imac27"
/>
</div>
<div class="card__content">
<h1 class="card__product-title">
APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A)
</h1>
<p class="card__product-code">Product code: 195434</p>
<div class="card__reviews">
<div class="stars stars--highlighted">
<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__reviews-amount">Reviews: 5</p>
</div>
<div class="card__price-row">
<p class="card__price">Price:</p>
<p class="card__price-amount">$2,199</p>
</div>
<a
class="card__button-link"
href="#"
data-qa="hover"
>
buy
</a>
</div>
</div>
</body>
</html>
103 changes: 103 additions & 0 deletions src/styles/blocks/card.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
.card {
box-sizing: border-box;
display: flex;
flex-direction: column;

font-family: Roboto, serif;
font-weight: 400;
background-color: #fff;
color: $main-color;
width: 200px;
height: 408px;
border: 1px solid #f3f3f3;
border-radius: 5px;

&__product {
box-sizing: inherit;
height: 166px;
padding: 32px 19px 0;
}

&__product-img {
width: 160px;
height: 134px;
}

&__content {
padding: 0 16px 15px;
}

&__product-title {
margin-top: 40px;
width: $width-card-content;
font-weight: 500;
font-size: 12px;
line-height: 18px;
}

&__product-code {
display: inline-block;
margin-bottom: 16px;
font-size: 10px;
line-height: 14px;
color: $secondary-color;
}

&__reviews {
display: flex;
height: $height-stars;
justify-content: space-between;
align-items: center;
}

&__reviews-amount {
font-family: inherit;
font-weight: inherit;
font-size: 10px;
color: $main-color;
}

&__price-row {
margin-top: 23px;
display: flex;
justify-content: space-between;
align-items: center;
}

&__price {
color: $secondary-color;
font-size: 12px;
}

&__price-amount {
font-weight: 700;
color: $main-color;
line-height: 18px;
font-size: 16px;
}

&__button-link {
box-sizing: border-box;
margin-top: 16px;
display: flex;
justify-content: center;
align-items: center;
height: 40px;
background-color: $btn-color;

border: 1px solid $btn-color;
border-radius: 5px;
text-decoration: none;
text-transform: uppercase;
font-weight: 700;
font-size: 14px;
line-height: 16px;
color: #fff;
}

&__button-link:hover {
background-color: #fff;
color: $btn-color;
margin-top: 17px;
}
}
17 changes: 17 additions & 0 deletions src/styles/blocks/stars.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.stars {
display: flex;
flex-direction: row;
gap: 4px;

&--highlighted :nth-child(-n + 4) {
background-image: url(../images/star-active.svg);
}

&__star {
background-image: url(../images/star.svg);
background-repeat: no-repeat;
width: 16px;
height: $height-stars;
background-position: 50% 30%;
}
}
7 changes: 4 additions & 3 deletions src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
body {
margin: 0;
}
@import 'utils/variables';
@import 'utils/reset';
@import 'blocks/card';
@import 'blocks/stars';
5 changes: 5 additions & 0 deletions src/styles/utils/reset.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
body,
h1,
p {
margin: 0;
}
5 changes: 5 additions & 0 deletions src/styles/utils/variables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
$main-color: #060b35;
$secondary-color: #616070;
$btn-color: #00acdc;
$width-card-content: 166px;
$height-stars: 16px;
Loading