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 solution #5178

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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://alla-vedmid.github.io/layout_product-cards/)
- [TEST REPORT LINK](https://alla-vedmid.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
50 changes: 49 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,60 @@
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"
crossorigin="attr-req-value"

Choose a reason for hiding this comment

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

The crossorigin attribute value 'attr-req-value' seems incorrect. It should be either 'anonymous' or 'use-credentials'. Please update it to the correct value.

Choose a reason for hiding this comment

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

The crossorigin attribute value is incorrect. It should be either 'anonymous' or 'use-credentials' as per the HTML specification. Please update this value to ensure proper functionality.

/>
<link
href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap"
rel="stylesheet"
/>
<link
rel="stylesheet"
href="./styles/index.scss"
/>
</head>
<body>
<h1>Product cards</h1>
<div
class="card"
data-qa="card"
>
<div class="card__image"></div>

<div class="card__description">
<span class="card__title">
APPLE A1419 iMac 27" Retina 5K&nbsp;Monoblock (MNED2UA/A)
</span>
<span class="card__prod-code">Product code: 195434</span>
</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-text">Reviews: 5</div>
</div>

<div class="card__price">
<div class="card__label">Price:</div>
<div class="card__value">$2,199</div>
</div>

<button
class="card__btn"
data-qa="hover"
>
Buy
</button>
</div>
</body>
</html>
97 changes: 97 additions & 0 deletions src/styles/blocks/card.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
$base-color: #060b35;
$color-light-gray: #616070;
$color-blue: #00acdc;
$color-white: #fff;
$color-border-card: #f3f3f3;
$card-radius: 5px;
$card-width: 198px;
$card-height: 406px;
$card-font: Roboto, sans-serif;

.card {
width: $card-width;

Choose a reason for hiding this comment

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

Ensure that the SCSS variable $card-width is defined in your project. If it's not defined, it will cause a compilation error.

height: $card-height;

Choose a reason for hiding this comment

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

Ensure that the SCSS variable $card-height is defined in your project. If it's not defined, it will cause a compilation error.

border: 1px solid $color-border-card;

Choose a reason for hiding this comment

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

Ensure that the SCSS variable $color-border-card is defined in your project. If it's not defined, it will cause a compilation error.

font-family: $card-font;

Choose a reason for hiding this comment

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

Ensure that the SCSS variable $card-font is defined in your project. If it's not defined, it will cause a compilation error.

border-radius: $card-radius;

Choose a reason for hiding this comment

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

Ensure that the SCSS variable $card-radius is defined in your project. If it's not defined, it will cause a compilation error.

margin: 50px;
padding: 17px;
display: flex;
flex-direction: column;
justify-content: space-between;

&__image {
background-image: url('../images/imac.jpeg');
width: 160px;
height: 134px;
display: block;
background-repeat: no-repeat;
background-size: cover;
margin: 16px auto 0;
}

&__description {
margin-top: 33px;
}
&__title {
font-size: 12px;
font-weight: 500;
line-height: 18px;
color: $base-color;

Choose a reason for hiding this comment

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

Ensure that the SCSS variable $base-color is defined in your project. If it's not defined, it will cause a compilation error.

display: block;
}
&__prod-code {
@include simple-text;

Choose a reason for hiding this comment

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

Ensure that the simple-text mixin is defined in your project. If it's missing, it will cause a compilation error.


display: block;
color: $color-light-gray;

Choose a reason for hiding this comment

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

Ensure that the SCSS variable $color-light-gray is defined in your project. If it's not defined, it will cause a compilation error.

}

&__reviews {
@include elem-space-between;

Choose a reason for hiding this comment

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

Ensure that the elem-space-between mixin is defined in your project. If it's missing, it will cause a compilation error.


margin: 20px 0;
}
&__reviews-text {
@include simple-text;

Choose a reason for hiding this comment

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

Ensure that the simple-text mixin is defined in your project. If it's missing, it will cause a compilation error.


color: $base-color;

Choose a reason for hiding this comment

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

Ensure that the SCSS variable $base-color is defined in your project. If it's not defined, it will cause a compilation error.

}

&__price {
@include elem-space-between;

Choose a reason for hiding this comment

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

Ensure that the elem-space-between mixin is defined in your project. If it's missing, it will cause a compilation error.

}

&__label {
font-size: 12px;
font-weight: 400;
line-height: 18px;
color: $color-light-gray;

Choose a reason for hiding this comment

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

Ensure that the SCSS variable $color-light-gray is defined in your project. If it's not defined, it will cause a compilation error.

}
&__value {
font-size: 16px;
font-weight: 700;
line-height: 18px;
}

&__btn {
width: 166px;
height: 40px;
border-radius: 5px;
background-color: $color-blue;

Choose a reason for hiding this comment

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

Ensure that the SCSS variable $color-blue is defined in your project. If it's not defined, it will cause a compilation error.

border: 1px solid $color-blue;

Choose a reason for hiding this comment

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

Ensure that the SCSS variable $color-blue is defined in your project. If it's not defined, it will cause a compilation error.

font-size: 14px;
font-weight: 700;
line-height: 16px;
color: $color-white;

Choose a reason for hiding this comment

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

Ensure that the SCSS variable $color-white is defined in your project. If it's not defined, it will cause a compilation error.

text-transform: uppercase;
align-self: center;
}

&:hover {
.card__btn {
background-color: $color-white;

Choose a reason for hiding this comment

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

Ensure that the SCSS variable $color-white is defined in your project. If it's not defined, it will cause a compilation error.

color: $color-blue;

Choose a reason for hiding this comment

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

Ensure that the SCSS variable $color-blue is defined in your project. If it's not defined, it will cause a compilation error.

}
}
}
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;

&__star {
background-image: url('../images/star.svg');
width: 16px;
height: 16px;
display: block;
background-repeat: no-repeat;
}
}

@for $i from 1 through 5 {
.stars--#{$i} .stars__star:nth-child(-n + #{$i}) {
background-image: url('../images/star-active.svg');
}
}
5 changes: 5 additions & 0 deletions src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@

@import 'utils/mixins';
@import 'blocks/card';
@import 'blocks/stars';

body {
margin: 0;
}
11 changes: 11 additions & 0 deletions src/styles/utils/mixins.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@mixin simple-text() {
font-size: 10px;
font-weight: 400;
line-height: 14px;
}

@mixin elem-space-between() {
display: flex;
justify-content: space-between;
align-items: center;
}
Loading