From a30a25a3cc644b169eb05fb4c61deb76ec5a0e32 Mon Sep 17 00:00:00 2001 From: Anton Olifan Date: Tue, 12 Nov 2024 13:50:27 +0100 Subject: [PATCH 1/2] add task solution --- readme.md | 6 +- src/index.html | 357 +++++++++++++++++++++++++++++++++++++- src/styles/card.scss | 121 +++++++++++++ src/styles/grid.scss | 24 +++ src/styles/header.scss | 21 +++ src/styles/index.scss | 10 ++ src/styles/nav.scss | 56 ++++++ src/styles/stars.scss | 18 ++ src/styles/variables.scss | 18 ++ 9 files changed, 627 insertions(+), 4 deletions(-) create mode 100644 src/styles/card.scss create mode 100644 src/styles/grid.scss create mode 100644 src/styles/header.scss create mode 100644 src/styles/nav.scss create mode 100644 src/styles/stars.scss create mode 100644 src/styles/variables.scss diff --git a/readme.md b/readme.md index 874ca70d97..1cb546e282 100644 --- a/readme.md +++ b/readme.md @@ -9,7 +9,7 @@ Create an HTML page with a catalog. Develop semantic page structure as shown on - add `data-qa="card-hover"` (not just `hover`) to the link `Buy` inside the first card - nav links color is not `black` anymore (nav links should have `#060b35` color) - add the class `is-active` to the first link (`Apple`) in the navigation -- use `
` tag for cards container +- use `
` tag for cards container - use the grid for cards with different numbers of columns: - 1 for the smaller screens - 2 starting at `488px` @@ -33,8 +33,8 @@ This is possible because [we use the Parcel library](https://en.parceljs.org/scs ## Checklist ❗️ Replace `` with your GitHub username and copy the links to the `Pull Request` description: -- [DEMO LINK](https://.github.io/layout_catalog/) -- [TEST REPORT LINK](https://.github.io/layout_catalog/report/html_report/) +- [DEMO LINK](https://olifan.github.io/layout_catalog/) +- [TEST REPORT LINK](https://olifan.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..22285b197d 100644 --- a/src/index.html +++ b/src/index.html @@ -22,6 +22,361 @@ -

Catalog

+
+ + +
+ +
+
+ iMac 27 Retina + +
+ APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A) +
+ +
Product code: 195434
+ +
+
+
+
+
+
+
+
+
Reviews: 5
+
+ +
+
Price:
+
$2,199
+
+ + +
BUY
+
+
+
+ iMac 27 Retina + +
+ APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A) +
+ +
Product code: 195434
+ +
+
+
+
+
+
+
+
+
Reviews: 5
+
+ +
+
Price:
+
$2,199
+
+ + +
BUY
+
+
+ +
+ iMac 27 Retina + +
+ APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A) +
+ +
Product code: 195434
+ +
+
+
+
+
+
+
+
+
Reviews: 5
+
+ +
+
Price:
+
$2,199
+
+ + +
BUY
+
+
+ +
+ iMac 27 Retina + +
+ APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A) +
+ +
Product code: 195434
+ +
+
+
+
+
+
+
+
+
Reviews: 5
+
+ +
+
Price:
+
$2,199
+
+ + +
BUY
+
+
+ +
+ iMac 27 Retina + +
+ APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A) +
+ +
Product code: 195434
+ +
+
+
+
+
+
+
+
+
Reviews: 5
+
+ +
+
Price:
+
$2,199
+
+ + +
BUY
+
+
+ +
+ iMac 27 Retina + +
+ APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A) +
+ +
Product code: 195434
+ +
+
+
+
+
+
+
+
+
Reviews: 5
+
+ +
+
Price:
+
$2,199
+
+ + +
BUY
+
+
+ +
+ iMac 27 Retina + +
+ APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A) +
+ +
Product code: 195434
+ +
+
+
+
+
+
+
+
+
Reviews: 5
+
+ +
+
Price:
+
$2,199
+
+ + +
BUY
+
+
+ +
+ iMac 27 Retina + +
+ 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..c9879043d4 --- /dev/null +++ b/src/styles/card.scss @@ -0,0 +1,121 @@ +@import './variables'; + +.card { + display: flex; + flex-direction: column; + box-sizing: border-box; + width: $card-width; + border: 1px solid $gray; + border-radius: 5px; + background-color: $white; + font-family: $font-family; + text-align: center; + transition: $transition-duration; + + &__title { + box-sizing: border-box; + font-weight: 500; + font-size: 12px; + line-height: 18px; + color: $main-accent; + margin: 0 16px; + text-align: left; + } + + &:hover { + transform: scale(1.2); + transition: $transition-duration; + + .card__title { + color: $card-title-hover; + } + } + + &__image { + display: block; + box-sizing: border-box; + padding: 33px 19px 40px; + width: 100%; + height: auto; + } + + &__code { + box-sizing: border-box; + font-weight: 400; + font-size: 10px; + line-height: 14px; + color: $secondary; + display: flex; + align-content: start; + margin: 4px 16px 0; + } + + &__price { + box-sizing: border-box; + display: flex; + justify-content: space-between; + margin: 24px 16px 0; + + &-text { + box-sizing: border-box; + font-size: 12px; + line-height: 18px; + font-weight: 400; + color: $secondary; + } + + &-num { + box-sizing: border-box; + font-weight: 700; + font-size: 16px; + line-height: 17px; + color: $main-accent; + } + } + + &__button { + box-sizing: border-box; + padding: 11px 16px; + background-color: $blue-accent; + text-decoration: none; + border: 1px solid $blue-accent; + border-radius: 5px; + margin: 16px; + cursor: pointer; + transition: background-color $transition-duration; + + &-text { + font-weight: 700; + font-size: 14px; + line-height: 16px; + color: $white; + } + + &:hover { + background-color: $white; + box-sizing: border-box; + color: $blue-accent; + + .card__button-text { + color: $blue-accent; + } + } + } + + &__stars { + box-sizing: border-box; + margin: 16px 16px 0; + display: flex; + flex-direction: row; + justify-content: space-between; + } + + .reviews { + box-sizing: border-box; + font-size: 10px; + line-height: 14px; + font-weight: 400; + align-self: flex-end; + margin: 0; + } +} diff --git a/src/styles/grid.scss b/src/styles/grid.scss new file mode 100644 index 0000000000..fe1984690d --- /dev/null +++ b/src/styles/grid.scss @@ -0,0 +1,24 @@ +// _grid.scss + +.catalog { + display: grid; + justify-content: center; + gap: $gap-vertical $gap-horizontal; + padding: $padding-vertical $padding-horizontal; + + @media (min-width: 1024px) { + grid-template-columns: repeat(4, $card-width); + } + + @media (min-width: 768px) and (max-width: 1023px) { + grid-template-columns: repeat(3, $card-width); + } + + @media (min-width: 488px) and (max-width: 767px) { + grid-template-columns: repeat(2, $card-width); + } + + @media (max-width: 487px) { + grid-template-columns: 1fr; + } +} diff --git a/src/styles/header.scss b/src/styles/header.scss new file mode 100644 index 0000000000..0eec5aff82 --- /dev/null +++ b/src/styles/header.scss @@ -0,0 +1,21 @@ +.header { + display: flex; + align-items: center; + justify-content: space-between; + padding: $header-padding; + background-color: #fff; + + &__logo { + display: flex; + align-items: center; + + a { + display: flex; + align-items: center; + + img { + height: $logo-height; + } + } + } +} diff --git a/src/styles/index.scss b/src/styles/index.scss index 293d3b1f13..6cdac4397d 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1,3 +1,13 @@ +@import 'variables'; +@import 'header'; +@import 'nav'; +@import 'card'; +@import 'stars'; +@import 'grid'; + body { margin: 0; + padding: 0; + box-sizing: border-box; + font-family: $font-family; } diff --git a/src/styles/nav.scss b/src/styles/nav.scss new file mode 100644 index 0000000000..ce5a92b5bb --- /dev/null +++ b/src/styles/nav.scss @@ -0,0 +1,56 @@ +.nav { + display: flex; + align-items: center; + + &__list { + display: flex; + list-style: none; + margin: 0; + padding: 0; + + &-item { + margin-right: $nav-margin-right; + + &:last-child { + margin-right: 0; + } + + &:first-child { + margin-left: 0; + } + + a { + text-decoration: none; + text-transform: uppercase; + text-align: center; + color: $main-accent; + font-weight: 500; + font-size: $font-size-small; + display: block; + line-height: $line-height; + transition: color $transition-duration; + + &:hover { + color: $blue-accent; + } + + &.is-active { + position: relative; + color: $blue-accent; + + &::after { + content: ''; + position: absolute; + bottom: 0; + left: 0; + right: 0; + width: 100%; + height: 4px; + border-radius: 8px; + background-color: $blue-accent; + } + } + } + } + } +} diff --git a/src/styles/stars.scss b/src/styles/stars.scss new file mode 100644 index 0000000000..61ea3a1c44 --- /dev/null +++ b/src/styles/stars.scss @@ -0,0 +1,18 @@ +@import './variables'; + +.stars { + display: flex; + + &__star { + width: 16px; + height: 16px; + background-image: url(../images/star.svg); + background-repeat: no-repeat; + background-position: center; + margin-right: 4px; + + &:nth-child(-n + 4) { + 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..143e50d440 --- /dev/null +++ b/src/styles/variables.scss @@ -0,0 +1,18 @@ +$header-padding: 0 50px; +$nav-margin-right: 20px; +$font-size-small: 12px; +$line-height: 60px; +$logo-height: 40px; +$card-width: 200px; +$font-family: 'Roboto', Helvetica, sans-serif; +$main-accent: #060b35; +$secondary: #616070; +$blue-accent: #00acdc; +$card-title-hover: #34568b; +$gray: #f3f3f3; +$white: #fff; +$padding-vertical: 50px; +$padding-horizontal: 40px; +$gap-horizontal: 46px; +$gap-vertical: 48px; +$transition-duration: 0.3s; From f178fa261aa897ebf03157b0d479d445f25d0b3c Mon Sep 17 00:00:00 2001 From: Anton Olifan Date: Tue, 12 Nov 2024 16:03:24 +0100 Subject: [PATCH 2/2] fix task solution --- src/index.html | 20 ++++++++++---------- src/styles/card.scss | 7 +++---- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/index.html b/src/index.html index 22285b197d..c2baec76cc 100644 --- a/src/index.html +++ b/src/index.html @@ -108,9 +108,9 @@
BUY
@@ -148,9 +148,9 @@
BUY
@@ -186,7 +186,7 @@
BUY
@@ -223,7 +223,7 @@
BUY
@@ -260,7 +260,7 @@
BUY
@@ -297,7 +297,7 @@
BUY
@@ -334,7 +334,7 @@
BUY
@@ -371,7 +371,7 @@
BUY
diff --git a/src/styles/card.scss b/src/styles/card.scss index c9879043d4..8f63e5d810 100644 --- a/src/styles/card.scss +++ b/src/styles/card.scss @@ -10,7 +10,7 @@ background-color: $white; font-family: $font-family; text-align: center; - transition: $transition-duration; + transition: transform $transition-duration; &__title { box-sizing: border-box; @@ -24,7 +24,7 @@ &:hover { transform: scale(1.2); - transition: $transition-duration; + transition: transform $transition-duration; .card__title { color: $card-title-hover; @@ -82,7 +82,7 @@ border-radius: 5px; margin: 16px; cursor: pointer; - transition: background-color $transition-duration; + transition: background-color $transition-duration ease; &-text { font-weight: 700; @@ -94,7 +94,6 @@ &:hover { background-color: $white; box-sizing: border-box; - color: $blue-accent; .card__button-text { color: $blue-accent;