diff --git a/readme.md b/readme.md index b1f43ed970..cb45376b5c 100644 --- a/readme.md +++ b/readme.md @@ -23,13 +23,13 @@ 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://VadimKudrenko.github.io/layout_product-cards/) +- [TEST REPORT LINK](https://VadimKudrenko.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..b43af8d371 100644 --- a/src/index.html +++ b/src/index.html @@ -7,12 +7,72 @@ content="width=device-width, initial-scale=1.0" /> Product cards + + + -

Product cards

+
+
+
+ card 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..d91f229476 --- /dev/null +++ b/src/styles/blocks/card.scss @@ -0,0 +1,113 @@ +.card { + box-sizing: border-box; + border: 1px solid #f3f3f3; + border-radius: 5px; + width: 200px; + padding: 32px 16px 16px; + margin: 0 auto; + + display: flex; + flex-direction: column; +} + +.card__image-wrapper { + height: 134px; + display: flex; + justify-content: center; + margin-bottom: 40px; +} + +.card__image { + width: 160px; + height: 134px; +} + +.card__title-wrapper { + margin-bottom: 4px; +} + +.card__title { + font-weight: 500; + font-size: 12px; + line-height: 18px; + color: $card-title-main-color; +} + +.card__product-code-wrapper { + margin-bottom: 16px; +} + +.card__product-code { + font-weight: 400; + font-size: 10px; + line-height: 14px; + color: $card-subtitle-color; +} + +.card__reviews-wrapper { + margin-bottom: 24px; +} + +.reviews { + display: flex; + justify-content: space-between; + align-items: center; +} + +.reviews__counter { + display: flex; + align-items: center; + height: 16px; + font-weight: 400; + font-size: 10px; + color: $card-title-main-color; +} + +.card__price-wrapper { + margin-bottom: 16px; +} + +.card__price { + display: flex; + justify-content: space-between; +} + +.card__price-title { + font-weight: 400; + font-size: 12px; + line-height: 18px; + color: $card-subtitle-color; +} + +.card__price-amount { + font-weight: 700; + font-size: 16px; + line-height: 18px; + color: $card-title-main-color; +} + +.card__buy-btn { + display: flex; + justify-content: center; + align-items: center; + + background-color: $card-buy-btn-color; + border-radius: 5px; + border: 1px solid $card-buy-btn-color; + box-sizing: border-box; + height: $card-buy-btn-height; + width: 100%; + + font-weight: 700; + font-size: 14px; + text-decoration: none; + text-transform: uppercase; + text-align: center; + color: #fff; + + &:hover { + cursor: pointer; + background-color: transparent; + color: $card-buy-btn-color; + } +} diff --git a/src/styles/blocks/stars.scss b/src/styles/blocks/stars.scss new file mode 100644 index 0000000000..265c561458 --- /dev/null +++ b/src/styles/blocks/stars.scss @@ -0,0 +1,21 @@ +.stars { + display: flex; +} + +.stars__star { + height: 16px; + width: 16px; + background-image: url(../images/star.svg); + background-position: center; + background-repeat: no-repeat; +} + +.stars__star:nth-child(n + 2) { + margin-left: 4px; +} + +@for $i from 0 through 5 { + .stars--#{$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..be50ff1433 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'; + +html { + font-family: Roboto, serif; +} + +body, +p, +h2 { margin: 0; } diff --git a/src/styles/utils/variables.scss b/src/styles/utils/variables.scss new file mode 100644 index 0000000000..6f03504794 --- /dev/null +++ b/src/styles/utils/variables.scss @@ -0,0 +1,4 @@ +$card-title-main-color: #060b35; +$card-subtitle-color: #616070; +$card-buy-btn-color: #00acdc; +$card-buy-btn-height: 40px;