From bf39d1517ce13ec41c2ce9b87e8294a4ce54f7ee Mon Sep 17 00:00:00 2001 From: Oleksandr Haman Date: Mon, 17 Jun 2024 11:55:57 +0200 Subject: [PATCH 1/4] add task solution --- readme.md | 6 +- src/index.html | 349 ++++++++++++++++++++++++++++++++++- src/styles/header.scss | 77 ++++++++ src/styles/index.scss | 7 +- src/styles/product-card.scss | 130 +++++++++++++ src/styles/stars.scss | 25 +++ src/styles/variables.scss | 8 + 7 files changed, 595 insertions(+), 7 deletions(-) create mode 100644 src/styles/header.scss create mode 100644 src/styles/product-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 705275c4af..8f0f009fe2 100644 --- a/readme.md +++ b/readme.md @@ -9,7 +9,7 @@ Create HTML page with catalog. Develop semantic page structure as shown on [the - add `data-qa="card-hover"` (not just `hover`) to the link `Buy` inside the first card - nav links color is not `black` any more (nav links should have `#060b35` color) - add class `is-active` to the first link (`Apple`) in navigation -- use `
` tag for cards container +- use `
` tag for cards container - use grid for cards with different number of columns: - 1 for the smaller screens - 2 starting at `488px` @@ -30,8 +30,8 @@ Make all the changes smooth on hover (during 300ms): ## Checklist ❗️ Replace `` with your Github username and copy the links to `Pull Request` description: -- [DEMO LINK](https://.github.io/layout_catalog/) -- [TEST REPORT LINK](https://.github.io/layout_catalog/report/html_report/) +- [DEMO LINK](https://OleksandrHaman.github.io/layout_catalog/) +- [TEST REPORT LINK](https://OleksandrHaman.github.io/layout_catalog/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 9cff78eeb7..c9d7041ba4 100644 --- a/src/index.html +++ b/src/index.html @@ -22,6 +22,353 @@ -

Catalog

+
+ + +
+
+
+
+ iMac + +

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

+ +

Product code: 195434

+ +
+
+
+
+
+
+
+
+ + Reviews: 5 +
+ +
+ Price: + $2,199 +
+ + +
+
+ iMac + +

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

+ +

Product code: 195434

+ +
+
+
+
+
+
+
+
+ + Reviews: 5 +
+ +
+ Price: + $2,199 +
+ + +
+
+ iMac + +

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

+ +

Product code: 195434

+ +
+
+
+
+
+
+
+
+ + Reviews: 5 +
+ +
+ Price: + $2,199 +
+ + +
+
+ iMac + +

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

+ +

Product code: 195434

+ +
+
+
+
+
+
+
+
+ + Reviews: 5 +
+ +
+ Price: + $2,199 +
+ + +
+
+ iMac + +

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

+ +

Product code: 195434

+ +
+
+
+
+
+
+
+
+ + Reviews: 5 +
+ +
+ Price: + $2,199 +
+ + +
+
+ iMac + +

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

+ +

Product code: 195434

+ +
+
+
+
+
+
+
+
+ + Reviews: 5 +
+ +
+ Price: + $2,199 +
+ + +
+
+ iMac + +

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

+ +

Product code: 195434

+ +
+
+
+
+
+
+
+
+ + Reviews: 5 +
+ +
+ Price: + $2,199 +
+ + +
+
+ iMac + +

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

+ +

Product code: 195434

+ +
+
+
+
+
+
+
+
+ + Reviews: 5 +
+ +
+ Price: + $2,199 +
+ + +
+
+
diff --git a/src/styles/header.scss b/src/styles/header.scss new file mode 100644 index 0000000000..73dcde898e --- /dev/null +++ b/src/styles/header.scss @@ -0,0 +1,77 @@ +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +html { + font-family: Roboto, sans-serif; +} + +body { + margin: 0; +} + +.header { + width: 100%; + display: flex; + box-sizing: border-box; + align-items: center; + justify-content: space-between; + padding: 0 50px; +} + +.logo { + display: flex; +} + +.nav { + margin: 0; + padding: 0; + + &__list { + list-style: none; + display: flex; + justify-content: center; + margin: 0; + padding: 0; + gap: 20px; + } + + &__item { + display: inline-block; + } + + &__link { + display: flex; + text-decoration: none; + color: #060b35; + align-items: center; + position: relative; + font-weight: 500; + font-style: normal; + font-size: 12px; + line-height: 14px; + text-transform: uppercase; + height: 60px; + transition: all 300ms; + + &:hover { + color: $headerColor; + } + } +} + +.is-active { + color: $headerColor; +} + +.is-active::after { + content: ''; + background-color: $headerColor; + border-radius: 2px; + width: 100%; + height: 4px; + position: absolute; + bottom: 0; +} diff --git a/src/styles/index.scss b/src/styles/index.scss index 293d3b1f13..afd5fc2f11 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1,3 +1,4 @@ -body { - margin: 0; -} +@import './variables'; +@import './header'; +@import './product-card'; +@import './stars'; diff --git a/src/styles/product-card.scss b/src/styles/product-card.scss new file mode 100644 index 0000000000..fedb46928b --- /dev/null +++ b/src/styles/product-card.scss @@ -0,0 +1,130 @@ +.container { + display: grid; + grid-template-columns: repeat(1, $cardSize); + justify-items: center; + justify-content: center; + gap: 46px 48px; + padding: 50px 40px; +} + +@media (min-width: 488px) { + .container { + grid-template-columns: repeat(2, $cardSize); + } +} + +@media (min-width: 768px) { + .container { + grid-template-columns: repeat(3, $cardSize); + } +} + +@media (min-width: 1024px) { + .container { + grid-template-columns: repeat(4, $cardSize); + } +} + +.product-card { + width: $cardWidth; + box-sizing: border-box; + padding: 32px 16px 16px; + border: #f3f3f3 solid 1px; + border-radius: 5px; + font-family: $mainFont; + transition: all $transitionTime; + + &__title { + margin: 0; + color: $mainColor; + font-weight: 500; + font-size: 12px; + line-height: 18px; + margin-bottom: 4px; + cursor: pointer; + transition: all $transitionTime; + } + + &:hover { + transform: scale(1.2); + } + + &:hover &__title { + color: #34568b; + } + + &__image { + display: block; + width: $imageWidth; + height: $imageHeight; + align-items: center; + margin-bottom: 40px; + padding-left: 3px; + } + + &__code { + margin: 0; + font-weight: 400; + font-size: 10px; + color: #616070; + margin-bottom: 16px; + } + + &__reviews-text { + text-align: right; + font-size: 10px; + font-weight: 400; + line-height: 14px; + color: $mainColor; + } + + &__reviews { + align-items: center; + display: flex; + justify-content: space-between; + padding-bottom: 24px; + } + + &__price { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 16px; + } + + &__price-cost { + font-weight: 400; + color: #616070; + font-size: 12px; + line-height: 18px; + } + + &__price-value { + color: $mainColor; + line-height: 18px; + font-size: 16px; + font-weight: 700; + text-align: right; + } + + &__buy { + cursor: pointer; + font-family: $mainFont; + font-size: 14px; + border-style: none; + width: 166px; + height: 40px; + background-color: $headerColor; + border-radius: 5px; + color: #fff; + text-transform: uppercase; + font-weight: 700; + transition: all $transitionTime; + + &:hover { + border: $headerColor solid 1px; + background-color: #fff; + color: $headerColor; + } + } +} diff --git a/src/styles/stars.scss b/src/styles/stars.scss new file mode 100644 index 0000000000..ff8e1559f4 --- /dev/null +++ b/src/styles/stars.scss @@ -0,0 +1,25 @@ +.stars { + display: flex; + + &__star { + margin-right: 4px; + width: 16px; + height: 16px; + background-image: url(../images/star.svg); + background-repeat: no-repeat; + display: inline-block; + background-position: 50%; + } + + &__star:last-child { + margin-right: 0; + } +} + +.stars--1 .stars__star:nth-child(-n + 1), +.stars--2 .stars__star:nth-child(-n + 2), +.stars--3 .stars__star:nth-child(-n + 3), +.stars--4 .stars__star:nth-child(-n + 4), +.stars--5 .stars__star:nth-child(-n + 5) { + background-image: url(/src/images/star-active.svg); +} diff --git a/src/styles/variables.scss b/src/styles/variables.scss new file mode 100644 index 0000000000..266de211f2 --- /dev/null +++ b/src/styles/variables.scss @@ -0,0 +1,8 @@ +$headerColor: #00acdc; +$mainColor: #060b35; +$mainFont: Roboto, sans-serif; +$imageWidth: 160px; +$imageHeight: 134px; +$cardWidth: 200px; +$cardSize: 200px; +$transitionTime: 300ms; From f02fc539692f6d322ea09ab3d1127f67f757e111 Mon Sep 17 00:00:00 2001 From: Oleksandr Haman Date: Mon, 17 Jun 2024 12:32:29 +0200 Subject: [PATCH 2/4] add box shadow --- src/styles/header.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/src/styles/header.scss b/src/styles/header.scss index 73dcde898e..5f9fc6858e 100644 --- a/src/styles/header.scss +++ b/src/styles/header.scss @@ -19,6 +19,7 @@ body { align-items: center; justify-content: space-between; padding: 0 50px; + box-shadow: 0 2px 4px 0 #0000000d; } .logo { From 62fd891801f9694820f3cf7f8ef42808045963ac Mon Sep 17 00:00:00 2001 From: Oleksandr Haman Date: Mon, 17 Jun 2024 12:45:34 +0200 Subject: [PATCH 3/4] add correction --- src/styles/header.scss | 14 -------------- src/styles/index.scss | 14 ++++++++++++++ src/styles/product-card.scss | 15 +++++++-------- src/styles/variables.scss | 1 + 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/styles/header.scss b/src/styles/header.scss index 5f9fc6858e..4072807f7e 100644 --- a/src/styles/header.scss +++ b/src/styles/header.scss @@ -1,17 +1,3 @@ -* { - margin: 0; - padding: 0; - box-sizing: border-box; -} - -html { - font-family: Roboto, sans-serif; -} - -body { - margin: 0; -} - .header { width: 100%; display: flex; diff --git a/src/styles/index.scss b/src/styles/index.scss index afd5fc2f11..dd3a22eeca 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -2,3 +2,17 @@ @import './header'; @import './product-card'; @import './stars'; + +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +html { + font-family: Roboto, sans-serif; +} + +body { + margin: 0; +} diff --git a/src/styles/product-card.scss b/src/styles/product-card.scss index fedb46928b..05dec694fa 100644 --- a/src/styles/product-card.scss +++ b/src/styles/product-card.scss @@ -35,12 +35,11 @@ transition: all $transitionTime; &__title { - margin: 0; color: $mainColor; font-weight: 500; font-size: 12px; line-height: 18px; - margin-bottom: 4px; + margin: 0 0 5px; cursor: pointer; transition: all $transitionTime; } @@ -59,15 +58,15 @@ height: $imageHeight; align-items: center; margin-bottom: 40px; - padding-left: 3px; + padding-left: auto; + padding-right: auto; } &__code { - margin: 0; font-weight: 400; font-size: 10px; color: #616070; - margin-bottom: 16px; + margin: 0 0 17px; } &__reviews-text { @@ -112,18 +111,18 @@ font-family: $mainFont; font-size: 14px; border-style: none; - width: 166px; + width: 100%; height: 40px; background-color: $headerColor; border-radius: 5px; - color: #fff; + color: $buttonColor; text-transform: uppercase; font-weight: 700; transition: all $transitionTime; &:hover { border: $headerColor solid 1px; - background-color: #fff; + background-color: $buttonColor; color: $headerColor; } } diff --git a/src/styles/variables.scss b/src/styles/variables.scss index 266de211f2..1bf4b918fa 100644 --- a/src/styles/variables.scss +++ b/src/styles/variables.scss @@ -6,3 +6,4 @@ $imageHeight: 134px; $cardWidth: 200px; $cardSize: 200px; $transitionTime: 300ms; +$buttonColor: #fff; From 9e53703443b0740d00d0446241c8ab84934e3015 Mon Sep 17 00:00:00 2001 From: Oleksandr Haman Date: Mon, 17 Jun 2024 23:28:52 +0200 Subject: [PATCH 4/4] add style separate file --- src/styles/container.scss | 26 ++++++++++++++++++++++++++ src/styles/general.scss | 13 +++++++++++++ src/styles/index.scss | 16 ++-------------- src/styles/product-card.scss | 29 +---------------------------- 4 files changed, 42 insertions(+), 42 deletions(-) create mode 100644 src/styles/container.scss create mode 100644 src/styles/general.scss diff --git a/src/styles/container.scss b/src/styles/container.scss new file mode 100644 index 0000000000..5507354679 --- /dev/null +++ b/src/styles/container.scss @@ -0,0 +1,26 @@ +.container { + display: grid; + grid-template-columns: repeat(1, $cardSize); + justify-items: center; + justify-content: center; + gap: 46px 48px; + padding: 50px 40px; +} + +@media (min-width: 488px) { + .container { + grid-template-columns: repeat(2, $cardSize); + } +} + +@media (min-width: 768px) { + .container { + grid-template-columns: repeat(3, $cardSize); + } +} + +@media (min-width: 1024px) { + .container { + grid-template-columns: repeat(4, $cardSize); + } +} diff --git a/src/styles/general.scss b/src/styles/general.scss new file mode 100644 index 0000000000..7e38f432d8 --- /dev/null +++ b/src/styles/general.scss @@ -0,0 +1,13 @@ +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +html { + font-family: Roboto, sans-serif; +} + +body { + margin: 0; +} diff --git a/src/styles/index.scss b/src/styles/index.scss index dd3a22eeca..1f4dda6ccf 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1,18 +1,6 @@ @import './variables'; +@import './general'; @import './header'; +@import './container'; @import './product-card'; @import './stars'; - -* { - margin: 0; - padding: 0; - box-sizing: border-box; -} - -html { - font-family: Roboto, sans-serif; -} - -body { - margin: 0; -} diff --git a/src/styles/product-card.scss b/src/styles/product-card.scss index 05dec694fa..b6df96f424 100644 --- a/src/styles/product-card.scss +++ b/src/styles/product-card.scss @@ -1,30 +1,3 @@ -.container { - display: grid; - grid-template-columns: repeat(1, $cardSize); - justify-items: center; - justify-content: center; - gap: 46px 48px; - padding: 50px 40px; -} - -@media (min-width: 488px) { - .container { - grid-template-columns: repeat(2, $cardSize); - } -} - -@media (min-width: 768px) { - .container { - grid-template-columns: repeat(3, $cardSize); - } -} - -@media (min-width: 1024px) { - .container { - grid-template-columns: repeat(4, $cardSize); - } -} - .product-card { width: $cardWidth; box-sizing: border-box; @@ -57,7 +30,7 @@ width: $imageWidth; height: $imageHeight; align-items: center; - margin-bottom: 40px; + margin: 0 auto 40px; padding-left: auto; padding-right: auto; }