From 319635c5c10047082387ccac1c52e673223a5649 Mon Sep 17 00:00:00 2001 From: Nataliia Vdovyna Date: Wed, 18 Dec 2024 13:42:05 +0200 Subject: [PATCH 1/2] add solution --- readme.md | 4 +-- src/index.html | 63 +++++++++++++++++++++++++++++++-- src/styles/blocks/card.scss | 39 ++++++++++++++++++++ src/styles/blocks/page.scss | 8 +++++ src/styles/blocks/price.scss | 57 +++++++++++++++++++++++++++++ src/styles/blocks/stars.scss | 31 ++++++++++++++++ src/styles/index.scss | 8 +++-- src/styles/utils/variables.scss | 6 ++++ 8 files changed, 209 insertions(+), 7 deletions(-) create mode 100644 src/styles/blocks/card.scss create mode 100644 src/styles/blocks/page.scss create mode 100644 src/styles/blocks/price.scss create mode 100644 src/styles/blocks/stars.scss create mode 100644 src/styles/utils/variables.scss diff --git a/readme.md b/readme.md index b1f43ed970..7e0599de4c 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://NataliiaVdovyna.github.io/layout_product-cards/) +- [TEST REPORT LINK](https://NataliiaVdovyna.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..64933f2108 100644 --- a/src/index.html +++ b/src/index.html @@ -1,3 +1,4 @@ + @@ -7,12 +8,70 @@ content="width=device-width, initial-scale=1.0" /> Product cards + + + - -

Product cards

+ + +
+
+
+ +
+

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

+

Product code: 195434

+
+
+ +
+
+
+
+
+
+
+
+ +
Reviews: 5
+
+ +
+
+

Price:

+ +

$2,199

+
+ + + + +
+
diff --git a/src/styles/blocks/card.scss b/src/styles/blocks/card.scss new file mode 100644 index 0000000000..558ed35b60 --- /dev/null +++ b/src/styles/blocks/card.scss @@ -0,0 +1,39 @@ +.card { + box-sizing: border-box; + width: 200px; + background-color: $background-color-special-white; + border-radius: 5px; + border: 1px solid #f3f3f3; + + text-align: center; + padding-block: 32px 16px; + + &__top-image { + box-sizing: border-box; + background-image: url(../images/imac.jpeg); + width: 160px; + height: 134px; + background-size: cover; + margin-left: auto; + margin-right: auto; + } + + &__top-text { + margin: 40px 16px 16px; + text-align: left; + } + + &__top-title { + margin: 0; + font-weight: 500; + line-height: 18px; + font-size: 12px; + } + + &__top-subtitle { + margin: 4px 0 0 0; + font-size: 10px; + line-height: 14px; + color: $other-text-color; + } +} diff --git a/src/styles/blocks/page.scss b/src/styles/blocks/page.scss new file mode 100644 index 0000000000..2a063d403b --- /dev/null +++ b/src/styles/blocks/page.scss @@ -0,0 +1,8 @@ +.page { + margin: 0; + margin-inline: 10px; + + font-family: 'Roboto', sans-serif; + font-weight: 400; + color: $main-text-color; +} diff --git a/src/styles/blocks/price.scss b/src/styles/blocks/price.scss new file mode 100644 index 0000000000..dab3b1ee4d --- /dev/null +++ b/src/styles/blocks/price.scss @@ -0,0 +1,57 @@ +.price { + margin-inline: $margin-inline; + + &__wrapper { + display: flex; + flex-direction: row; + justify-content: space-between; + + align-items: center; + margin: 24px 0 16px; + } + + &__text { + margin: 0; + font-size: 12px; + font-weight: 400; + line-height: 18px; + color: $other-text-color; + } + + &__money { + margin: 0; + font-size: 16px; + font-weight: 700; + line-height: 18px; + } + + &__link { + display: block; + } + + &__button { + padding: 0; + background-color: $button-color; + width: 166px; + height: 40px; + border-radius: 5px; + + font-family: Roboto; + font-size: 14px; + font-weight: 700; + line-height: 16px; + text-align: center; + color: $background-color-special-white; + text-transform: uppercase; + + border: none; + outline: none; + box-shadow: none; + + &:hover { + color: $button-color; + background-color: $background-color-special-white; + border: 1px solid $button-color; + } + } +} diff --git a/src/styles/blocks/stars.scss b/src/styles/blocks/stars.scss new file mode 100644 index 0000000000..51521a2a58 --- /dev/null +++ b/src/styles/blocks/stars.scss @@ -0,0 +1,31 @@ +.stars { + display: flex; + flex-direction: row; + justify-content: space-between; + margin-inline: $margin-inline; + align-items: end; + + &__wrapper { + display: flex; + justify-content: space-between; + width: 96px; + } + + &__star { + background-image: url(../images/star-active.svg); + background-repeat: no-repeat; + background-position: 50%; + width: 16px; + height: 16px; + } + + &__star:last-child { + background-image: url(../images/star.svg); + } + + &__text { + font-size: 10px; + font-weight: 400; + line-height: 14px; + } +} diff --git a/src/styles/index.scss b/src/styles/index.scss index 293d3b1f13..40f5bc0c5c 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1,3 +1,5 @@ -body { - margin: 0; -} +@import './utils/variables'; +@import './blocks/page'; +@import './blocks/card'; +@import './blocks/stars'; +@import './blocks/price'; diff --git a/src/styles/utils/variables.scss b/src/styles/utils/variables.scss new file mode 100644 index 0000000000..ca858e131c --- /dev/null +++ b/src/styles/utils/variables.scss @@ -0,0 +1,6 @@ +$margin-inline: 16px; + +$main-text-color: #060b35; +$other-text-color: #616070; +$button-color: #00acdc; +$background-color-special-white: #ffffff; From 09c67c3ca2e13f5c6acf0d1e585fa56e03e60ddb Mon Sep 17 00:00:00 2001 From: Nataliia Vdovyna Date: Thu, 19 Dec 2024 01:10:37 +0200 Subject: [PATCH 2/2] fixed files --- src/index.html | 22 +++++++++++++--------- src/styles/blocks/card.scss | 27 +++++++++++++++++++++------ src/styles/blocks/page.scss | 2 +- src/styles/blocks/price.scss | 19 ++++++------------- src/styles/blocks/stars.scss | 16 +--------------- src/styles/utils/variables.scss | 3 +-- 6 files changed, 43 insertions(+), 46 deletions(-) diff --git a/src/index.html b/src/index.html index 64933f2108..914281bce5 100644 --- a/src/index.html +++ b/src/index.html @@ -33,7 +33,11 @@ data-qa="card" >
-
+ computer

@@ -45,16 +49,16 @@

-
-
-
-
-
-
+
+
+
+
+
+
-
Reviews: 5
+

Reviews: 5

@@ -69,7 +73,7 @@

class="price__link" data-qa="hover" > - + Buy

diff --git a/src/styles/blocks/card.scss b/src/styles/blocks/card.scss index 558ed35b60..e95c61a9b8 100644 --- a/src/styles/blocks/card.scss +++ b/src/styles/blocks/card.scss @@ -9,13 +9,10 @@ padding-block: 32px 16px; &__top-image { - box-sizing: border-box; - background-image: url(../images/imac.jpeg); + display: block; width: 160px; height: 134px; - background-size: cover; - margin-left: auto; - margin-right: auto; + margin-inline: 19px; } &__top-text { @@ -31,9 +28,27 @@ } &__top-subtitle { - margin: 4px 0 0 0; + margin: 0; + margin-top: 4px; font-size: 10px; line-height: 14px; color: $other-text-color; } + + &__review { + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + margin: 0; + height: 16px; + margin-inline: $margin-inline; + } + + &__review-text { + font-size: 10px; + font-weight: 400; + line-height: 14px; + margin: 0; + } } diff --git a/src/styles/blocks/page.scss b/src/styles/blocks/page.scss index 2a063d403b..18ca9ae1bc 100644 --- a/src/styles/blocks/page.scss +++ b/src/styles/blocks/page.scss @@ -2,7 +2,7 @@ margin: 0; margin-inline: 10px; - font-family: 'Roboto', sans-serif; + font-family: Roboto, sans-serif; font-weight: 400; color: $main-text-color; } diff --git a/src/styles/blocks/price.scss b/src/styles/blocks/price.scss index dab3b1ee4d..186692a3ff 100644 --- a/src/styles/blocks/price.scss +++ b/src/styles/blocks/price.scss @@ -1,13 +1,12 @@ .price { - margin-inline: $margin-inline; - &__wrapper { display: flex; flex-direction: row; justify-content: space-between; align-items: center; - margin: 24px 0 16px; + margin-block: 24px 16px; + margin-inline: $margin-inline; } &__text { @@ -27,26 +26,20 @@ &__link { display: block; - } + margin-inline: $margin-inline; - &__button { - padding: 0; background-color: $button-color; - width: 166px; height: 40px; border-radius: 5px; - font-family: Roboto; + font-family: Roboto, sans-serif; font-size: 14px; font-weight: 700; line-height: 16px; - text-align: center; + align-content: center; color: $background-color-special-white; text-transform: uppercase; - - border: none; - outline: none; - box-shadow: none; + text-decoration: none; &:hover { color: $button-color; diff --git a/src/styles/blocks/stars.scss b/src/styles/blocks/stars.scss index 51521a2a58..0f0ec4607d 100644 --- a/src/styles/blocks/stars.scss +++ b/src/styles/blocks/stars.scss @@ -1,15 +1,7 @@ .stars { display: flex; - flex-direction: row; justify-content: space-between; - margin-inline: $margin-inline; - align-items: end; - - &__wrapper { - display: flex; - justify-content: space-between; - width: 96px; - } + width: 96px; &__star { background-image: url(../images/star-active.svg); @@ -22,10 +14,4 @@ &__star:last-child { background-image: url(../images/star.svg); } - - &__text { - font-size: 10px; - font-weight: 400; - line-height: 14px; - } } diff --git a/src/styles/utils/variables.scss b/src/styles/utils/variables.scss index ca858e131c..05941b8ec6 100644 --- a/src/styles/utils/variables.scss +++ b/src/styles/utils/variables.scss @@ -1,6 +1,5 @@ $margin-inline: 16px; - $main-text-color: #060b35; $other-text-color: #616070; $button-color: #00acdc; -$background-color-special-white: #ffffff; +$background-color-special-white: #fff;