From 5c1125bafb50d3ee526c6c8adaee417bd03b0d5b Mon Sep 17 00:00:00 2001 From: Nazar Vandenko Date: Mon, 21 Oct 2024 12:51:30 +0300 Subject: [PATCH] add task solution --- readme.md | 4 +- src/index.html | 60 ++++++++++++++++++++++- src/styles/blocks/card.scss | 87 +++++++++++++++++++++++++++++++++ src/styles/blocks/stars.scss | 20 ++++++++ src/styles/index.scss | 8 +++ src/styles/utils/mixins.scss | 6 +++ src/styles/utils/variables.scss | 6 +++ 7 files changed, 188 insertions(+), 3 deletions(-) create mode 100644 src/styles/blocks/card.scss create mode 100644 src/styles/blocks/stars.scss create mode 100644 src/styles/utils/mixins.scss create mode 100644 src/styles/utils/variables.scss diff --git a/readme.md b/readme.md index 3354ca6020..b3916e8231 100644 --- a/readme.md +++ b/readme.md @@ -20,8 +20,8 @@ Create a pages with product card using `flexbox`, `BEM` and `SCSS` based on [thi ❗️ Replace `` with your Github username and copy the links to `Pull Request` description: -- [DEMO LINK](https://.github.io/layout_product-cards/) -- [TEST REPORT LINK](https://.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. diff --git a/src/index.html b/src/index.html index 43745cc17f..79810a6ec3 100644 --- a/src/index.html +++ b/src/index.html @@ -6,6 +6,18 @@ name="viewport" content="width=device-width, initial-scale=1.0" /> + + + Product cards -

Product cards

+
+ Product + +
+
+ APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A) +
+ +
Product code: 195434
+ +
+
+
+ +
+ +
+ +
+ +
+
+
Reviews: 5
+
+ +
+ Price + + $2,199 +
+ + + Buy + +
+
diff --git a/src/styles/blocks/card.scss b/src/styles/blocks/card.scss new file mode 100644 index 0000000000..67659f675e --- /dev/null +++ b/src/styles/blocks/card.scss @@ -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 { + width: 160px; + height: 134px; + margin-bottom: 40px; + } + + &__title { + font-size: 12px; + line-height: 18px; + font-weight: 500; + color: $main-text-color; + margin-bottom: 4px; + } + + &__product-code { + @include text-secondary; + + margin-bottom: 16px; + } + + &__reviews { + display: flex; + align-items: center; + justify-content: space-between; + margin-bottom: 24px; + } + + &__reviews-count { + @include text-secondary; + + text-align: right; + } + + &__price { + display: flex; + align-items: center; + justify-content: space-between; + margin-bottom: 16px; + } + + &__price-text { + font-size: 14px; + line-height: 18px; + font-weight: 400; + } + + &__price-value { + font-size: 16px; + line-height: 18px; + font-weight: 700; + color: $main-text-color; + } + + &__button { + 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 { + background-color: #fff; + color: $accent-color; + } +} diff --git a/src/styles/blocks/stars.scss b/src/styles/blocks/stars.scss new file mode 100644 index 0000000000..f49c62336b --- /dev/null +++ b/src/styles/blocks/stars.scss @@ -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'); +} diff --git a/src/styles/index.scss b/src/styles/index.scss index 293d3b1f13..234e330595 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -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; } diff --git a/src/styles/utils/mixins.scss b/src/styles/utils/mixins.scss new file mode 100644 index 0000000000..9760e075e9 --- /dev/null +++ b/src/styles/utils/mixins.scss @@ -0,0 +1,6 @@ +@mixin text-secondary() { + font-size: 10px; + line-height: 14px; + font-weight: 400; + color: $secondary-text-color; +} diff --git a/src/styles/utils/variables.scss b/src/styles/utils/variables.scss new file mode 100644 index 0000000000..5dccf44b84 --- /dev/null +++ b/src/styles/utils/variables.scss @@ -0,0 +1,6 @@ +$card-width: 200px; +$card-padding: 16px; +$border-radius: 5px; +$main-text-color: #060b35; +$secondary-text-color: #616070; +$accent-color: #00acdc;