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 #5091

Open
wants to merge 2 commits 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://ALexKhodakov.github.io/layout_product-cards/)
- [TEST REPORT LINK](https://ALexKhodakov.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
59 changes: 58 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,68 @@
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"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SCSS file index.scss is linked here. Ensure that SCSS variables are placed in a separate file, and separate BEM block files are used for card and stars, as per the task requirements.

/>
</head>
<!-- #endregion -->
<body>
<h1>Product cards</h1>
<div
class="card"
data-qa="card"
>
<img
src="../src/images/imac.jpeg"
alt="APPLE A1419 iMac 27"
class="card__image"
/>

<h2 class="card__title">
APPLE A1419 iMac 27" Retina
<br />
5K Monoblock (MNED2UA/A)
</h2>

<div class="card__code">Product code: 195434</div>

<div class="card__review-container">
<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>
<div class="card__review-count">Reviews: 5</div>
</div>

<div class="card__price-container">
<div class="card__price-label">Price:</div>
<div class="card__price">$2,199</div>
</div>

<div>
<a
href="#"
class="card__buy"
data-qa="hover"
>
Buy
</a>
</div>
</div>
</body>
</html>
117 changes: 117 additions & 0 deletions src/styles/blocks/card.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
html {
font-family: Roboto, sans-serif;
font-size: 10px;
line-height: 14px;
color: $text-secondary-color;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that SCSS variables like $text-secondary-color are placed in a separate variables file, as required by the task.

}

body {
margin: 0;
}

.card {
box-sizing: border-box;
width: 200px;
border: 1px solid #f3f3f3;
border-radius: 5px;
padding: 32px 16px 16px;
background-color: #fff;
&__image {
display: block;
margin: 0 auto 40px;
width: 160px;
height: 134px;
}

&__title {
margin: 0 0 4px;
font-size: 12px;
font-weight: 500;
line-height: 18px;
color: $text-accent-color;
}

&__code {
margin-bottom: 16px;
}

&__review-container {
display: flex;
justify-content: space-between;
align-items: flex-end;
margin-bottom: 24px;
}

&__review-count {
color: $text-accent-color;
}

&__price-container {
display: flex;
justify-content: space-between;
margin-bottom: 16px;
}

&__price-label {
font-size: 12px;
line-height: 18px;
}

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

&__buy {
display: flex;
justify-content: center;
align-items: center;

box-sizing: border-box;
height: 40px;
border: 1px solid $main-color;
border-radius: 5px;

font-size: 14px;
line-height: 16px;
font-weight: 700;
text-transform: uppercase;
color: #fff;
text-decoration: none;

background-color: $main-color;
}

&__buy:hover {
color: $main-color;
background-color: #fff;
}
}

.stars {
display: flex;

&__star {
width: 16px;
height: 16px;
margin-right: 4px;

background-image: url(../images/star.svg);
background-repeat: no-repeat;
background-position: center;

& :last-child {
margin-right: 0;
}
}
}

.stars--1 .stars__star:nth-child(-n + 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),
.stars--5 .stars__star:nth-child(-n + 5) {
background-image: url(../images/star-active.svg);
}
Comment on lines +93 to +117

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The styles for the stars component should be moved to a separate SCSS file dedicated to the stars BEM block, as per the task requirements.

5 changes: 2 additions & 3 deletions src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
body {
margin: 0;
}
@import './utils/variables';
@import './blocks/card';
3 changes: 3 additions & 0 deletions src/styles/utils/variables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
$main-color: #00acdc;
$text-accent-color: #060b35;
$text-secondary-color: #616070;
Loading