From f53ddaf586bf3e753985c8536e6a084e686258ac Mon Sep 17 00:00:00 2001 From: fromjkeee16 Date: Sun, 5 Jan 2025 23:20:01 +0200 Subject: [PATCH] Solution --- readme.md | 18 +++---- src/index.html | 64 ++++++++++++++++++++++-- src/styles/blocks/card.scss | 86 +++++++++++++++++++++++++++++++++ src/styles/blocks/page.scss | 5 ++ src/styles/blocks/stars.scss | 16 ++++++ src/styles/index.scss | 7 +-- src/styles/utils/variables.scss | 7 +++ 7 files changed, 187 insertions(+), 16 deletions(-) create mode 100644 src/styles/blocks/card.scss create mode 100644 src/styles/blocks/page.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..b341b1b07d 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,6 @@ # Product cards -Create a page with product card using `flexbox`, `BEM` and `SCSS` based on [this mockup](https://www.figma.com/file/ojkArVazq7vsX0nbpn9CxZ/Moyo-%2F-Catalog-(ENG)?node-id=11325%3A2287&mode=dev). +Create a page with product card using `flexbox`, `BEM` and `SCSS` based on [this mockup](). > Here are the [Layout Tasks Instructions](https://mate-academy.github.io/layout_task-guideline) @@ -16,20 +16,20 @@ Create a page with product card using `flexbox`, `BEM` and `SCSS` based on [this - Rewrite the `stars` block from the [Stars task](https://github.com/mate-academy/layout_stars) with SCSS and use it - Find the required font on [google fonts](https://fonts.google.com/) and use. -*Important note*: In this task, you are allowed to link `*.scss` files directly in HTML `` tags using `href` attribute. +_Important note_: In this task, you are allowed to link `*.scss` files directly in HTML `` tags using `href` attribute. This is possible because [we use the Parcel library](https://en.parceljs.org/scss.html) to bundle your solution's source code. ## Checklist ❗️ 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://fromjkeee16.github.io/layout_product-cards/) +- [TEST REPORT LINK](https://fromjkeee16.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. -- [ ] there 2 BEM blocks `card` and `stars` each in their own file -- [ ] SCSS Nesting is used for `elements`, `modifiers` and `pseudo-classes` -- [ ] SCSS Variables are used for main values and placed in a **separate file** -- [ ] all `stars--N` modifiers work as expected (Highlight first `N` stars) -- [ ] Code follows all the [Code Style Rules ❗️](https://mate-academy.github.io/layout_task-guideline/html-css-code-style-rules) +- [x] there 2 BEM blocks `card` and `stars` each in their own file +- [x] SCSS Nesting is used for `elements`, `modifiers` and `pseudo-classes` +- [x] SCSS Variables are used for main values and placed in a **separate file** +- [x] all `stars--N` modifiers work as expected (Highlight first `N` stars) +- [x] Code follows all the [Code Style Rules ❗️](https://mate-academy.github.io/layout_task-guideline/html-css-code-style-rules) diff --git a/src/index.html b/src/index.html index 43745cc17f..76a7251f89 100644 --- a/src/index.html +++ b/src/index.html @@ -1,18 +1,74 @@ + - + - Product cards + card cards + + + - -

Product cards

+ + +
+
+ Apple iMac card photo +
+
+ 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..d5625bc837 --- /dev/null +++ b/src/styles/blocks/card.scss @@ -0,0 +1,86 @@ +.card { + padding: 32px 16px 16px; + width: 200px; + + box-sizing: border-box; + border: 1px solid #f3f3f3; + border-radius: 5px; + + &__banner { + margin-bottom: 40px; + } + + &__photo { + height: 134px; + width: 160px; + display: block; + margin: 0 auto; + } + + &__title { + font-weight: 500; + font-size: 12px; + line-height: 18px; + margin-bottom: 4px; + } + + &__code { + font-weight: 400; + font-size: 10px; + line-height: 14px; + color: $secondary-color; + margin-bottom: 16px; + } + + &__rating { + display: flex; + justify-content: space-between; + margin-bottom: 24px; + } + + &__number-reviews { + line-height: 14px; + font-size: 10px; + font-weight: 400; + } + + &__price { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 16px; + line-height: $primary-lineheight; + + &-label { + font-size: 12px; + color: $secondary-color; + } + + &-number { + font-weight: bold; + font-size: 16px; + } + } + + &__button-element { + display: block; + height: 40px; + border-radius: 5px; + box-sizing: border-box; + + color: white; + font-weight: bold; + text-align: center; + align-content: center; + text-transform: uppercase; + text-decoration: none; + background-color: $blue-accent-color; + border: 1px solid $blue-accent-color; + + &:hover { + color: $blue-accent-color; + background-color: white; + cursor: pointer; + } + } +} diff --git a/src/styles/blocks/page.scss b/src/styles/blocks/page.scss new file mode 100644 index 0000000000..cbb3aa5cf4 --- /dev/null +++ b/src/styles/blocks/page.scss @@ -0,0 +1,5 @@ +.page__body { + margin: 0; + font-family: Roboto, serif; + color: $main-color; +} diff --git a/src/styles/blocks/stars.scss b/src/styles/blocks/stars.scss new file mode 100644 index 0000000000..62bcb97396 --- /dev/null +++ b/src/styles/blocks/stars.scss @@ -0,0 +1,16 @@ +.stars { + display: flex; + + &__star { + height: $stars-size; + width: $stars-size; + margin-right: 4px; + background-repeat: no-repeat; + background-position: center; + background-image: url('../images/star.svg'); + } + + &--4 &__star:nth-child(-n + 4) { + background-image: url('../images/star-active.svg'); + } +} diff --git a/src/styles/index.scss b/src/styles/index.scss index 293d3b1f13..2ff023ffa3 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1,3 +1,4 @@ -body { - margin: 0; -} +@import './utils/variables'; +@import './blocks/page'; +@import './blocks/card'; +@import './blocks/stars'; diff --git a/src/styles/utils/variables.scss b/src/styles/utils/variables.scss new file mode 100644 index 0000000000..7760e886ce --- /dev/null +++ b/src/styles/utils/variables.scss @@ -0,0 +1,7 @@ +$blue-accent-color: #00acdc; +$main-color: #060b35; +$secondary-color: #616070; +$card-width: 200px; +$primary-lineheight: 18px; +$secondary-lineheight: 14px; +$stars-size: 16px;