Skip to content

Commit

Permalink
add task solution
Browse files Browse the repository at this point in the history
  • Loading branch information
vladislav-tsybuliak1 committed Dec 21, 2024
1 parent 606dc21 commit c6b4ab2
Show file tree
Hide file tree
Showing 6 changed files with 196 additions and 6 deletions.
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://vladislav-tsybuliak1.github.io/layout_product-cards/)
- [TEST REPORT LINK](https://vladislav-tsybuliak1.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
56 changes: 55 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,66 @@
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="anonymous"
/>
<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>
<body>
<h1>Product cards</h1>
<div
class="card"
data-qa="card"
>
<img
class="card__image"
src="images/imac.jpeg"
alt="iMac image"
/>

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

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

<div class="card__review">
<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>

<p class="card__review-amount">Reviews: 5</p>
</div>

<div class="card__price">
<p class="card__price-label">Price:</p>

<p class="card__price-amount">$2,199</p>
</div>

<a
data-qa="hover"
href="#"
class="button card__button"
>
Buy
</a>
</div>
</body>
</html>
109 changes: 109 additions & 0 deletions src/styles/blocks/card.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
.card {
margin: 0;
font-family: Roboto, serif;
text-align: left;

display: flex;
flex-direction: column;
justify-content: center;
box-sizing: border-box;
padding: 32px 16px 16px;
width: 200px;

border: 1px #f3f3f3 solid;

&__image {
height: 134px;
width: 160px;
padding-bottom: 40px;
align-self: center;
}

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

&__code {
margin: 0;
font-size: 10px;
font-weight: 400;
line-height: 14px;
padding-bottom: 16px;
color: $secondary-color;
}

&__review {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
padding-bottom: 24px;

&-amount {
margin: 0;
font-size: 10px;
font-weight: 400;
line-height: 14px;
text-align: right;
color: $main-color;
display: flex;
}
}

&__price {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
padding-bottom: 16px;

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

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

&__button {
box-sizing: border-box;
border-radius: 5px;
background-color: $blue-color;
height: 40px;
border: none;
color: #fff;

font-size: 14px;
font-weight: 700;
line-height: 16px;
text-align: center;
text-decoration: none;
text-transform: uppercase;

display: flex;
align-items: center;
justify-content: center;

&:hover {
background-color: #fff;
color: $blue-color;
border: 1px solid $blue-color;
}
}
}
24 changes: 24 additions & 0 deletions src/styles/blocks/stars.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.stars {
display: flex;
align-items: center;

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

height: 16px;
width: 16px;
margin-right: 4px;

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

@for $i from 1 through 5 {
&--#{$i} .stars__star:nth-child(-n + #{$i}) {
background-image: url(../images/star-active.svg);
}
}
}
6 changes: 3 additions & 3 deletions src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
body {
margin: 0;
}
@import './utils/variables';
@import './blocks/card';
@import './blocks/stars';
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: #060b35;
$secondary-color: #616070;
$blue-color: #00acdc;

0 comments on commit c6b4ab2

Please sign in to comment.