From f7f657e9e885f5b104021956919e5dcda3f86d1f Mon Sep 17 00:00:00 2001 From: Maksim Date: Sun, 15 Dec 2024 18:02:54 +0200 Subject: [PATCH 1/3] add task solution --- readme.md | 8 ++-- src/index.html | 50 ++++++++++++++++++++++- src/styles/card.scss | 84 +++++++++++++++++++++++++++++++++++++++ src/styles/index.scss | 5 +++ src/styles/stars.scss | 20 ++++++++++ src/styles/variables.scss | 6 +++ 6 files changed, 168 insertions(+), 5 deletions(-) create mode 100644 src/styles/card.scss create mode 100644 src/styles/stars.scss create mode 100644 src/styles/variables.scss diff --git a/readme.md b/readme.md index b1f43ed970..9cd672b50b 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,15 +16,15 @@ 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://maks-сhervyakov.github.io/layout_product-cards/) +- [TEST REPORT LINK](https://maks-сhervyakov.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..84a7da7aaf 100644 --- a/src/index.html +++ b/src/index.html @@ -7,12 +7,60 @@ 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 +
+ + Buy + +
diff --git a/src/styles/card.scss b/src/styles/card.scss new file mode 100644 index 0000000000..adf4dc93d4 --- /dev/null +++ b/src/styles/card.scss @@ -0,0 +1,84 @@ +.card { + font-family: Roboto, sans-serif; + box-sizing: border-box; + padding: 32px 16px 16px; + background: $white; + border: 1px solid $gray-elements; + border-radius: 5px; + max-width: 200px; + &__image { + width: 100%; + height: 134px; + background-image: url(../images/imac.jpeg); + background-position: center; + background-size: cover; + margin: 0 auto 40px; + } + &__title { + font-weight: 500; + font-size: 12px; + line-height: 18px; + color: $main-accent; + margin-bottom: 4px; + } + &__code { + font-weight: 400; + font-size: 10px; + line-height: 1.4; + color: $secondary; + } + &__rating { + display: flex; + justify-content: space-between; + flex-wrap: wrap; + align-items: center; + margin-top: 16px; + margin-bottom: 24px; + &-reviews { + font-size: 10px; + line-height: 14px; + color: $main-accent; + font-weight: 400; + text-align: right; + } + } + &__price { + display: flex; + justify-content: space-between; + flex-wrap: wrap; + align-items: center; + font-weight: 400; + font-size: 12px; + color: $secondary; + strong { + font-weight: 700; + font-size: 16px; + line-height: 1.13; + color: $main-accent; + } + + margin-bottom: 16px; + } + &__button { + box-sizing: border-box; + border-radius: 5px; + background: $blue-accent; + width: 166px; + height: 40px; + display: flex; + align-items: center; + justify-content: center; + text-transform: uppercase; + text-decoration: none; + font-weight: 700; + font-size: 14px; + line-height: 16px; + color: $white; + transition: 0.2s ease-in-out; + border: 1px solid $blue-accent; + &:hover { + color: $blue-accent; + background: $white; + } + } +} diff --git a/src/styles/index.scss b/src/styles/index.scss index 293d3b1f13..8b97732bc9 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1,3 +1,8 @@ body { margin: 0; + padding: 0; } + +@import 'variables'; +@import 'card'; +@import 'stars'; diff --git a/src/styles/stars.scss b/src/styles/stars.scss new file mode 100644 index 0000000000..9497bf1aa7 --- /dev/null +++ b/src/styles/stars.scss @@ -0,0 +1,20 @@ +.stars { + display: flex; + &__star { + width: 16px; + height: 16px; + background-position: center; + background-repeat: no-repeat; + background-image: url(../images/star.svg); + 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/variables.scss b/src/styles/variables.scss new file mode 100644 index 0000000000..2d0811f536 --- /dev/null +++ b/src/styles/variables.scss @@ -0,0 +1,6 @@ +$main-accent: #060b35; +$secondary: #616070; +$white: #fff; +$blue-accent: #00acdc; +$gray-elements: #f3f3f3; +$yellow-stars: #ffde6a; From d7d9d407b195887bbc35d76a247d97f42bea6317 Mon Sep 17 00:00:00 2001 From: Maksim Date: Sun, 15 Dec 2024 18:14:37 +0200 Subject: [PATCH 2/3] try fix --- .linthtmlrc.json | 12 +----------- readme.md | 4 ++-- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/.linthtmlrc.json b/.linthtmlrc.json index 477c99b1b9..b12945d719 100644 --- a/.linthtmlrc.json +++ b/.linthtmlrc.json @@ -10,7 +10,6 @@ "attr-name-ignore-regex": "viewBox", "attr-no-dup": true, "attr-quote-style": "double", - "attr-req-value": true, "class-no-dup": true, "doctype-first": true, "doctype-html5": true, @@ -26,16 +25,7 @@ "indent-width-cont": true, "input-radio-req-name": true, "spec-char-escape": true, - "tag-bans": [ - "b", - "i", - "u", - "center", - "style", - "marquee", - "font", - "s" - ], + "tag-bans": ["b", "i", "u", "center", "style", "marquee", "font", "s"], "tag-name-lowercase": true, "tag-name-match": true, "tag-self-close": false, diff --git a/readme.md b/readme.md index 9cd672b50b..72758c4e9d 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://maks-сhervyakov.github.io/layout_product-cards/) -- [TEST REPORT LINK](https://maks-сhervyakov.github.io/layout_product-cards/report/html_report/) +- [DEMO LINK](https://maks-chervyakov.github.io/layout_product-cards/) +- [TEST REPORT LINK](https://maks-chervyakov.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. From 97ef753a405f845e01778c041061f3146cb5e1da Mon Sep 17 00:00:00 2001 From: Maksim Date: Mon, 16 Dec 2024 13:01:27 +0200 Subject: [PATCH 3/3] fix product image --- src/index.html | 7 ++++++- src/styles/card.scss | 7 ++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/index.html b/src/index.html index 84a7da7aaf..f66fcb9946 100644 --- a/src/index.html +++ b/src/index.html @@ -30,7 +30,12 @@ class="card" data-qa="card" > -
+
+ iMac 27 +

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

diff --git a/src/styles/card.scss b/src/styles/card.scss index adf4dc93d4..5bc2741215 100644 --- a/src/styles/card.scss +++ b/src/styles/card.scss @@ -9,10 +9,11 @@ &__image { width: 100%; height: 134px; - background-image: url(../images/imac.jpeg); - background-position: center; - background-size: cover; margin: 0 auto 40px; + + img { + max-width: 100%; + } } &__title { font-weight: 500;