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

Develop #5086

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Develop #5086

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://IvanIlnytskyy.github.io/layout_product-cards/)
- [TEST REPORT LINK](https://IvanIlnytskyy.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"
/>
<link
href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&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 task requires SCSS variables to be defined in a separate file. Ensure that you have a separate SCSS file for variables and that it is imported correctly in your SCSS files. The Parcel bundler should handle the compilation of SCSS to CSS.

/>
</head>
<body>
<h1>Product cards</h1>
<div class="product-cards">
<div
class="product-card"
data-qa="card"
>
<img
src="./images/imac.jpeg"
alt="imac"
class="product-card__image"
/>
<h2 class="product-card__title">
APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A)
</h2>
<p class="product-card__description">Product code: 195434</p>
<div class="mark">
<div class="stars stars--4">
<span class="stars__star"></span>
<span class="stars__star"></span>
<span class="stars__star"></span>
<span class="stars__star"></span>
<span class="stars__star"></span>
</div>
<p class="mark__reviews">Reviews: 5</p>
</div>
<div class="price">
<p class="price__word">Price:</p>
<p class="price__numeric">$2,199</p>
</div>
<a
href="#"
data-qa="hover"
class="bottom"
>
BUY
</a>
</div>
</div>
</body>
</html>
135 changes: 135 additions & 0 deletions src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,138 @@
$hover-text-color: #34568b;
$main-color: #00acdc;
$text-color: #060b35;
$dark-gray: #616070;
$white: #fff;
$grey: #f3f3f3;

body {
margin: 0;
font-family: Roboto, sans-serif;
}

Choose a reason for hiding this comment

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

Consider using SCSS variables for properties like font-family, background-color, and other repeated values. This will help maintain consistency and make it easier to update styles globally.


.product-card {
box-sizing: border-box;
width: 200px;
background-color: $white;
border-radius: 5px;
border: 1px solid $grey;
padding: 32px 16px 16px;
background-position: center;

&__image {
display: block;
margin: 0 auto 40px;
width: 160px;
height: 134px;
background-size: cover;
background-position: center;
}

&__title {
display: flex;
font-size: 12px;
line-height: 18px;
font-weight: 500;
margin-bottom: 4px;
color: $text-color;

&:hover {
color: $hover-text-color;
}
}

&__description {
font-size: 10px;
line-height: 14px;
color: $dark-gray;
margin: 0 0 16px;
}
}

.mark {
display: flex;
height: 16px;
margin-bottom: 24px;
justify-content: space-between;
align-items: center;

&__reviews {
font-size: 10px;
line-height: 14px;
text-align: right;
font-weight: 400;
color: $text-color;
}
}

.price {
display: flex;
justify-content: space-between;
margin-bottom: 16px;

&__word {
font-size: 12px;
font-weight: 400;
line-height: 18px;
text-align: left;
color: $dark-gray;
margin: 0;
}

&__numeric {
font-size: 16px;
font-weight: 700;
line-height: 18px;
text-align: right;
color: $text-color;
margin: 0;
}
}

.bottom {
display: block;
text-align: center;
padding: 12px;
font-size: 14px;
line-height: 16px;
color: $white;
text-decoration: none;
border-radius: 5px;
font-weight: 700;
background-color: $main-color;

&:hover {
display: block;
text-align: center;
padding: 12px;
font-size: 14px;
line-height: 16px;
text-decoration: none;
border-radius: 5px;
font-weight: 700;
position: relative;
background-color: $white;
color: $main-color;
box-sizing: border-box;
border: 1px solid $main-color;
}
}

.stars {
display: flex;

&__star {
background-image: url(../images/star.svg);
background-position: 50%;
background-repeat: no-repeat;
width: 16px;
height: 16px;
border-radius: 0.5px;
gap: 4px;
margin-right: 4px;

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