From 6f25c400964ec9acfb904b3114562252bd4c551d Mon Sep 17 00:00:00 2001 From: Aleksey Date: Fri, 20 Dec 2024 15:32:56 +0200 Subject: [PATCH 1/2] add task solution --- readme.md | 4 +- src/index.html | 59 ++++++++++++++++++++- src/styles/index.scss | 119 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 179 insertions(+), 3 deletions(-) diff --git a/readme.md b/readme.md index b1f43ed970..b43795d390 100644 --- a/readme.md +++ b/readme.md @@ -23,8 +23,8 @@ This is possible because [we use the Parcel library](https://en.parceljs.org/scs ❗️ Replace `` with your GitHub username and copy the links to the `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://ALexKhodakov.github.io/layout_product-cards/) +- [TEST REPORT LINK](https://ALexKhodakov.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..ceddf3c8d2 100644 --- a/src/index.html +++ b/src/index.html @@ -1,3 +1,4 @@ + @@ -7,12 +8,68 @@ content="width=device-width, initial-scale=1.0" /> Product cards + + + + -

Product cards

+
+ APPLE A1419 iMac 27 + +

+ APPLE A1419 iMac 27" Retina +
+ 5K Monoblock (MNED2UA/A) +

+ +
Product code: 195434
+ +
+
+
+
+
+
+
+
+
Reviews: 5
+
+ +
+
Price:
+
$2,199
+
+ + +
diff --git a/src/styles/index.scss b/src/styles/index.scss index 293d3b1f13..443bc4c653 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1,3 +1,122 @@ +html { + --main-color: #00acdc; + --text-accent-color: #060b35; + --text-secondary-color: #616070; + + font-family: Roboto, sans-serif; + font-size: 10px; + line-height: 14px; + color: var(--text-secondary-color); +} + body { margin: 0; } + +.card { + box-sizing: border-box; + width: 200px; + border: 1px solid #f3f3f3; + border-radius: 5px; + padding: 32px 16px 16px; + background-color: #fff; +} + +.card__image { + display: block; + margin: 0 auto 40px; + width: 160px; + height: 134px; +} + +.card__title { + margin: 0 0 4px; + font-size: 12px; + font-weight: 500; + line-height: 18px; + color: var(--text-accent-color); +} + +.card__code { + margin-bottom: 16px; +} + +.card__review-container { + display: flex; + justify-content: space-between; + align-items: flex-end; + margin-bottom: 24px; +} + +.card__review-count { + color: var(--text-accent-color); +} + +.card__price-container { + display: flex; + justify-content: space-between; + margin-bottom: 16px; +} + +.card__price-label { + font-size: 12px; + line-height: 18px; +} + +.card__price { + color: var(--text-accent-color); + font-size: 16px; + line-height: 18px; + font-weight: 700; +} + +.card__buy { + display: flex; + justify-content: center; + align-items: center; + + box-sizing: border-box; + height: 40px; + border: 1px solid var(--main-color); + border-radius: 5px; + + font-size: 14px; + line-height: 16px; + font-weight: 700; + text-transform: uppercase; + color: #fff; + text-decoration: none; + + background-color: var(--main-color); +} + +.card__buy:hover { + color: var(--main-color); + background-color: #fff; +} + +.stars { + display: flex; +} + +.stars__star { + width: 16px; + height: 16px; + margin-right: 4px; + + background-image: url(../images/star.svg); + background-repeat: no-repeat; + background-position: center; +} + +.stars__star :last-child { + margin-right: 0; +} + +.stars--1 .stars__star:nth-child(-n + 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); +} From 0afc4e01f64cd2446c75175bdbf6d5ac8489b060 Mon Sep 17 00:00:00 2001 From: Aleksey Date: Sat, 21 Dec 2024 00:00:55 +0200 Subject: [PATCH 2/2] Fix the issues --- src/styles/blocks/card.scss | 117 ++++++++++++++++++++++++++++++ src/styles/index.scss | 124 +------------------------------- src/styles/utils/variables.scss | 3 + 3 files changed, 122 insertions(+), 122 deletions(-) create mode 100644 src/styles/blocks/card.scss create mode 100644 src/styles/utils/variables.scss diff --git a/src/styles/blocks/card.scss b/src/styles/blocks/card.scss new file mode 100644 index 0000000000..6247922387 --- /dev/null +++ b/src/styles/blocks/card.scss @@ -0,0 +1,117 @@ +html { + font-family: Roboto, sans-serif; + font-size: 10px; + line-height: 14px; + color: $text-secondary-color; +} + +body { + margin: 0; +} + +.card { + box-sizing: border-box; + width: 200px; + border: 1px solid #f3f3f3; + border-radius: 5px; + padding: 32px 16px 16px; + background-color: #fff; + &__image { + display: block; + margin: 0 auto 40px; + width: 160px; + height: 134px; + } + + &__title { + margin: 0 0 4px; + font-size: 12px; + font-weight: 500; + line-height: 18px; + color: $text-accent-color; + } + + &__code { + margin-bottom: 16px; + } + + &__review-container { + display: flex; + justify-content: space-between; + align-items: flex-end; + margin-bottom: 24px; + } + + &__review-count { + color: $text-accent-color; + } + + &__price-container { + display: flex; + justify-content: space-between; + margin-bottom: 16px; + } + + &__price-label { + font-size: 12px; + line-height: 18px; + } + + &__price { + color: $text-accent-color; + font-size: 16px; + line-height: 18px; + font-weight: 700; + } + + &__buy { + display: flex; + justify-content: center; + align-items: center; + + box-sizing: border-box; + height: 40px; + border: 1px solid $main-color; + border-radius: 5px; + + font-size: 14px; + line-height: 16px; + font-weight: 700; + text-transform: uppercase; + color: #fff; + text-decoration: none; + + background-color: $main-color; + } + + &__buy:hover { + color: $main-color; + background-color: #fff; + } +} + +.stars { + display: flex; + + &__star { + width: 16px; + height: 16px; + margin-right: 4px; + + background-image: url(../images/star.svg); + background-repeat: no-repeat; + background-position: center; + + & :last-child { + margin-right: 0; + } + } +} + +.stars--1 .stars__star:nth-child(-n + 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 443bc4c653..b084987b54 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1,122 +1,2 @@ -html { - --main-color: #00acdc; - --text-accent-color: #060b35; - --text-secondary-color: #616070; - - font-family: Roboto, sans-serif; - font-size: 10px; - line-height: 14px; - color: var(--text-secondary-color); -} - -body { - margin: 0; -} - -.card { - box-sizing: border-box; - width: 200px; - border: 1px solid #f3f3f3; - border-radius: 5px; - padding: 32px 16px 16px; - background-color: #fff; -} - -.card__image { - display: block; - margin: 0 auto 40px; - width: 160px; - height: 134px; -} - -.card__title { - margin: 0 0 4px; - font-size: 12px; - font-weight: 500; - line-height: 18px; - color: var(--text-accent-color); -} - -.card__code { - margin-bottom: 16px; -} - -.card__review-container { - display: flex; - justify-content: space-between; - align-items: flex-end; - margin-bottom: 24px; -} - -.card__review-count { - color: var(--text-accent-color); -} - -.card__price-container { - display: flex; - justify-content: space-between; - margin-bottom: 16px; -} - -.card__price-label { - font-size: 12px; - line-height: 18px; -} - -.card__price { - color: var(--text-accent-color); - font-size: 16px; - line-height: 18px; - font-weight: 700; -} - -.card__buy { - display: flex; - justify-content: center; - align-items: center; - - box-sizing: border-box; - height: 40px; - border: 1px solid var(--main-color); - border-radius: 5px; - - font-size: 14px; - line-height: 16px; - font-weight: 700; - text-transform: uppercase; - color: #fff; - text-decoration: none; - - background-color: var(--main-color); -} - -.card__buy:hover { - color: var(--main-color); - background-color: #fff; -} - -.stars { - display: flex; -} - -.stars__star { - width: 16px; - height: 16px; - margin-right: 4px; - - background-image: url(../images/star.svg); - background-repeat: no-repeat; - background-position: center; -} - -.stars__star :last-child { - margin-right: 0; -} - -.stars--1 .stars__star:nth-child(-n + 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); -} +@import './utils/variables'; +@import './blocks/card'; diff --git a/src/styles/utils/variables.scss b/src/styles/utils/variables.scss new file mode 100644 index 0000000000..5378f1861b --- /dev/null +++ b/src/styles/utils/variables.scss @@ -0,0 +1,3 @@ +$main-color: #00acdc; +$text-accent-color: #060b35; +$text-secondary-color: #616070;