From 3b21f11a3f4a6d181201b9761068bd4ad0604438 Mon Sep 17 00:00:00 2001 From: cementix Date: Wed, 25 Dec 2024 13:07:11 +0100 Subject: [PATCH 1/3] add task solution --- src/index.html | 53 ++++++++++++++++- src/styles/blocks/card.scss | 102 ++++++++++++++++++++++++++++++++ src/styles/blocks/stars.scss | 24 ++++++++ src/styles/index.scss | 12 +++- src/styles/utils/variables.scss | 3 + 5 files changed, 192 insertions(+), 2 deletions(-) create mode 100644 src/styles/blocks/card.scss create mode 100644 src/styles/blocks/stars.scss create mode 100644 src/styles/utils/variables.scss diff --git a/src/index.html b/src/index.html index 43745cc17f..6e23508642 100644 --- a/src/index.html +++ b/src/index.html @@ -11,8 +11,59 @@ rel="stylesheet" href="./styles/index.scss" /> + + + -

Product cards

+
+ product image + +

+ 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..cc03c4d9ac --- /dev/null +++ b/src/styles/blocks/card.scss @@ -0,0 +1,102 @@ +@use '../utils/variables.scss'; + +.card { + width: 200px; + height: 408px; + padding: 32px 16px 16px; + border: 1px solid white; + border-radius: 5px; + display: flex; + flex-direction: column; + align-items: center; + text-align: left; + + &__image { + width: 160px; + height: 134px; + margin-bottom: 40px; + } + + &__title { + font-weight: 500; + font-size: 12px; + line-height: 18px; + color: variables.$main-accent; + margin-bottom: 4px; + } + + &__code { + width: 100%; + font-weight: 400; + font-size: 10px; + line-height: 14px; + color: variables.$secondary-accent; + margin-bottom: 16px; + } + + &__reviews { + width: 100%; + display: flex; + align-items: center; + justify-content: space-between; + margin-bottom: 24px; + } + + &__stars { + margin-right: 17px; + } + + &__reviews-count { + font-weight: 400; + font-size: 10px; + line-height: 14px; + text-align: right; + color: variables.$main-accent; + } + + &__price { + width: 100%; + display: flex; + justify-content: space-between; + + &-text { + font-weight: 400; + font-size: 12px; + line-height: 18px; + color: variables.$secondary-accent; + } + + &-value { + font-weight: 700; + font-size: 16px; + line-height: 18px; + text-align: right; + color: variables.$main-accent; + } + + margin-bottom: 16px; + } + + &__button { + width: 166px; + height: 40px; + display: flex; + align-items: center; + justify-content: center; + font-weight: 700; + color: white; + font-size: 14px; + line-height: 16px; + text-align: center; + border: none; + border-radius: 5px; + text-decoration: none; + background-color: variables.$blue-accent; + + &:hover { + background-color: white; + color: variables.$blue-accent; + border: 1px solid variables.$blue-accent; + } + } +} diff --git a/src/styles/blocks/stars.scss b/src/styles/blocks/stars.scss new file mode 100644 index 0000000000..e621d78ab4 --- /dev/null +++ b/src/styles/blocks/stars.scss @@ -0,0 +1,24 @@ +@use '../utils/variables.scss'; + +.stars { + display: flex; + + &__star { + width: 16px; + height: 16px; + background-image: url('../images/star.svg'); + background-repeat: no-repeat; + background-position: center; + 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'); + } + } +} diff --git a/src/styles/index.scss b/src/styles/index.scss index 293d3b1f13..e3c2612750 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1,3 +1,13 @@ -body { +@import './utils/variables'; +@import './blocks/card'; +@import './blocks/stars'; + +* { margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + font-family: Roboto, serif; } diff --git a/src/styles/utils/variables.scss b/src/styles/utils/variables.scss new file mode 100644 index 0000000000..f664a1a3de --- /dev/null +++ b/src/styles/utils/variables.scss @@ -0,0 +1,3 @@ +$main-accent: #060b35; +$secondary-accent: #616070; +$blue-accent: #00acdc; From e193622b2798ba545cdf60e180dff877aebecb9b Mon Sep 17 00:00:00 2001 From: cementix Date: Wed, 25 Dec 2024 13:10:21 +0100 Subject: [PATCH 2/3] add readme --- readme.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/readme.md b/readme.md index b1f43ed970..b293b8575b 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,7 +16,7 @@ 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 @@ -28,8 +28,8 @@ This is possible because [we use the Parcel library](https://en.parceljs.org/scs ❗️ 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) From 8d487ec13540277377b0966863f24bae84c4c501 Mon Sep 17 00:00:00 2001 From: cementix Date: Wed, 25 Dec 2024 13:10:59 +0100 Subject: [PATCH 3/3] add readme --- readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index b293b8575b..f74e5b83d7 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://cementix.github.io/layout_product-cards/) +- [TEST REPORT LINK](https://cementix.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.