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

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 @@ -20,8 +20,8 @@ Create a pages with product card using `flexbox`, `BEM` and `SCSS` based on [thi

❗️ Replace `<your_account>` with your Github username and copy the links to `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://thshnhta.github.io/layout_product-cards/)
- [TEST REPORT LINK](https://thshnhta.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
60 changes: 59 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,71 @@
name="viewport"
content="width=device-width, initial-scale=1.0"
/>
<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"
/>
<title>Product cards</title>
<link
rel="stylesheet"
href="./styles/index.scss"
/>
</head>
<body>
<h1>Product cards</h1>
<div
class="card"
data-qa="card"
>
<img
class="card__image"
src="./images/imac.jpeg"
alt="Product"
/>

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

<div class="card__product-code">Product code: 195434</div>

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

<div class="card__price">
<span class="card__price-text">Price</span>

<span class="card__price-value">$2,199</span>
</div>

<a
href="#"
class="card__button"
data-qa="hover"
>
Buy
</a>
</div>
</div>
</body>
</html>
87 changes: 87 additions & 0 deletions src/styles/blocks/card.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
.card {
box-sizing: border-box;
display: flex;
flex-direction: column;
align-items: center;
width: 200px;
padding: 32px 16px 16px;
border: 1px solid #f3f3f3;
border-radius: $border-radius;
background-color: #fff;

&__image {

Choose a reason for hiding this comment

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

The BEM naming convention suggests using a single underscore for element names, like &-image instead of &__image. Consider changing this to maintain consistency with BEM.

width: 160px;
height: 134px;
margin-bottom: 40px;
}

&__title {

Choose a reason for hiding this comment

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

The BEM naming convention suggests using a single underscore for element names, like &-title instead of &__title. Consider changing this to maintain consistency with BEM.

font-size: 12px;
line-height: 18px;
font-weight: 500;
color: $main-text-color;
margin-bottom: 4px;
}

&__product-code {

Choose a reason for hiding this comment

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

The BEM naming convention suggests using a single underscore for element names, like &-product-code instead of &__product-code. Consider changing this to maintain consistency with BEM.

@include text-secondary;

margin-bottom: 16px;
}

&__reviews {

Choose a reason for hiding this comment

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

The BEM naming convention suggests using a single underscore for element names, like &-reviews instead of &__reviews. Consider changing this to maintain consistency with BEM.

display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 24px;
}

&__reviews-count {

Choose a reason for hiding this comment

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

The BEM naming convention suggests using a single underscore for element names, like &-reviews-count instead of &__reviews-count. Consider changing this to maintain consistency with BEM.

@include text-secondary;

text-align: right;
}

&__price {

Choose a reason for hiding this comment

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

The BEM naming convention suggests using a single underscore for element names, like &-price instead of &__price. Consider changing this to maintain consistency with BEM.

display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 16px;
}

&__price-text {

Choose a reason for hiding this comment

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

The BEM naming convention suggests using a single underscore for element names, like &-price-text instead of &__price-text. Consider changing this to maintain consistency with BEM.

font-size: 14px;
line-height: 18px;
font-weight: 400;
}

&__price-value {

Choose a reason for hiding this comment

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

The BEM naming convention suggests using a single underscore for element names, like &-price-value instead of &__price-value. Consider changing this to maintain consistency with BEM.

font-size: 16px;
line-height: 18px;
font-weight: 700;
color: $main-text-color;
}

&__button {

Choose a reason for hiding this comment

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

The BEM naming convention suggests using a single underscore for element names, like &-button instead of &__button. Consider changing this to maintain consistency with BEM.

box-sizing: border-box;
height: 40px;
display: flex;
border-radius: $border-radius;
border: 1px solid $accent-color;
align-items: center;
justify-content: center;
text-transform: uppercase;
text-decoration: none;
color: #fff;
background-color: $accent-color;
font-size: 14px;
line-height: 16px;
font-weight: 700;
transition: all 0.2s ease;
}

&__button:hover {

Choose a reason for hiding this comment

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

The BEM naming convention suggests using a single underscore for element names, like &-button:hover instead of &__button:hover. Consider changing this to maintain consistency with BEM.

background-color: #fff;
color: $accent-color;
}
}
20 changes: 20 additions & 0 deletions src/styles/blocks/stars.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.stars {
display: flex;
}

.stars__star {
height: 16px;
width: 16px;
background-image: url('../images/star.svg');
background-repeat: no-repeat;
background-position: 50%;
margin-right: 4px;
}

.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),
.stars--5 .stars__star:nth-child(-n + 5) {
background-image: url('../images/star-active.svg');
}
8 changes: 8 additions & 0 deletions src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
@import './utils/variables';
@import './utils/mixins';
@import 'blocks/card';
@import 'blocks/stars';

body {
margin: 0;
padding: 50px;
background-color: #f0f0f0;
font-family: Roboto, Arial, sans-serif;
}
6 changes: 6 additions & 0 deletions src/styles/utils/mixins.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@mixin text-secondary() {
font-size: 10px;
line-height: 14px;
font-weight: 400;
color: $secondary-text-color;
}
6 changes: 6 additions & 0 deletions src/styles/utils/variables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
$card-width: 200px;
$card-padding: 16px;
$border-radius: 5px;
$main-text-color: #060b35;
$secondary-text-color: #616070;
$accent-color: #00acdc;
Loading