From 8e8723cd600b75a8b0ba13f4365a82c6f2148898 Mon Sep 17 00:00:00 2001 From: Ivan Ilnytskyy Date: Mon, 30 Dec 2024 23:15:40 +0200 Subject: [PATCH] add task solution --- src/index.html | 391 +++++++++++++++++++++++++++++++++++++- src/styles/grid.scss | 19 ++ src/styles/header.scss | 65 +++++++ src/styles/index.scss | 120 ++++++++++++ src/styles/stars.scss | 18 ++ src/styles/variables.scss | 6 + 6 files changed, 618 insertions(+), 1 deletion(-) create mode 100644 src/styles/grid.scss create mode 100644 src/styles/header.scss create mode 100644 src/styles/stars.scss create mode 100644 src/styles/variables.scss diff --git a/src/index.html b/src/index.html index 9cff78eeb7..955ed1fcf5 100644 --- a/src/index.html +++ b/src/index.html @@ -22,6 +22,395 @@ -

Catalog

+
+ + + +
+ + + +
+
+
+ imac +

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

+

Product code: 195434

+
+
+ + + + + +
+

Reviews: 5

+
+
+

Price:

+

$2,199

+
+ + BUY + +
+
+
+
+ imac +

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

+

Product code: 195434

+
+
+ + + + + +
+

Reviews: 5

+
+
+

Price:

+

$2,199

+
+ + BUY + +
+
+
+
+ imac +

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

+

Product code: 195434

+
+
+ + + + + +
+

Reviews: 5

+
+
+

Price:

+

$2,199

+
+ + BUY + +
+
+
+
+ imac +

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

+

Product code: 195434

+
+
+ + + + + +
+

Reviews: 5

+
+
+

Price:

+

$2,199

+
+ + BUY + +
+
+
+
+ imac +

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

+

Product code: 195434

+
+
+ + + + + +
+

Reviews: 5

+
+
+

Price:

+

$2,199

+
+ + BUY + +
+
+
+
+ imac +

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

+

Product code: 195434

+
+
+ + + + + +
+

Reviews: 5

+
+
+

Price:

+

$2,199

+
+ + BUY + +
+
+
+
+ imac +

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

+

Product code: 195434

+
+
+ + + + + +
+

Reviews: 5

+
+
+

Price:

+

$2,199

+
+ + BUY + +
+
+
+
+ imac +

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

+

Product code: 195434

+
+
+ + + + + +
+

Reviews: 5

+
+
+

Price:

+

$2,199

+
+ + BUY + +
+
+
+ diff --git a/src/styles/grid.scss b/src/styles/grid.scss new file mode 100644 index 0000000000..61fa73c391 --- /dev/null +++ b/src/styles/grid.scss @@ -0,0 +1,19 @@ +.catalog { + display: grid; + gap: 46px 48px; + padding: 50px 40px; + align-items: center; + justify-content: center; + + @media (min-width: 488px) { + grid-template-columns: repeat(2, 200px); + } + + @media (min-width: 768px) { + grid-template-columns: repeat(3, 200px); + } + + @media (min-width: 1024px) { + grid-template-columns: repeat(4, 200px); + } +} diff --git a/src/styles/header.scss b/src/styles/header.scss new file mode 100644 index 0000000000..f61187e63a --- /dev/null +++ b/src/styles/header.scss @@ -0,0 +1,65 @@ +.header { + display: flex; + align-items: center; + justify-content: space-between; + background-color: $white; + font-weight: 500; + padding: 0 50px; + box-sizing: border-box; +} + +.logo { + height: 40px; + width: 40px; +} + +.nav__list { + display: flex; + margin: 0; + padding: 0; + list-style: none; +} + +.nav__item { + margin-right: 20px; +} + +.nav__link { + text-decoration: none; + color: $text-color; + line-height: 60px; + font-family: Roboto, sans-serif; + font-weight: 500; + text-transform: uppercase; + display: block; + text-align: center; + font-size: 12px; +} + +.nav__link.is-active { + color: $main-color; + position: relative; +} + +.nav__list:first-child { + margin-left: 0; +} + +.nav__list:last-child { + margin-right: 0; +} + +.nav__link:hover { + color: $main-color; +} + +.is-active::after { + content: ''; + position: absolute; + bottom: 0; + left: 0; + width: 100%; + height: 4px; + border-radius: 8px; + background-color: $main-color; +} diff --git a/src/styles/index.scss b/src/styles/index.scss index 293d3b1f13..471d546e8b 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1,3 +1,123 @@ +@import './variables'; +@import './header'; +@import './stars'; +@import './grid'; + body { margin: 0; + font-family: Roboto, sans-serif; +} + +.product-card { + transition: transform 300ms ease-in-out; + box-sizing: border-box; + width: 200px; + background-color: $white; + border-radius: 5px; + border: 1px solid $grey; + padding: 32px 16px 16px; + background-position: center; + + &:hover { + transform: scale(1.2); + z-index: 10; + } + + &__image { + display: block; + margin: 0 auto 40px; + width: 160px; + height: 134px; + background-size: cover; + background-position: center; + } + + &__title { + display: flex; + font-size: 12px; + line-height: 18px; + font-weight: 500; + margin-bottom: 4px; + color: $text-color; + + &:hover { + color: $hover-text-color; + } + } + + &__description { + font-size: 10px; + line-height: 14px; + color: $dark-gray; + margin: 0 0 16px; + } +} + +.mark { + display: flex; + height: 16px; + margin-bottom: 24px; + justify-content: space-between; + align-items: center; + + &__reviews { + font-size: 10px; + line-height: 14px; + text-align: right; + font-weight: 400; + color: $text-color; + } +} + +.price { + display: flex; + justify-content: space-between; + margin-bottom: 16px; + + &__word { + font-size: 12px; + font-weight: 400; + line-height: 18px; + text-align: left; + color: $dark-gray; + margin: 0; + } + + &__numeric { + font-size: 16px; + font-weight: 700; + line-height: 18px; + text-align: right; + color: $text-color; + margin: 0; + } +} + +.bottom { + display: block; + text-align: center; + padding: 12px; + font-size: 14px; + line-height: 16px; + color: $white; + text-decoration: none; + border-radius: 5px; + font-weight: 700; + background-color: $main-color; + + &:hover { + display: block; + text-align: center; + padding: 12px; + font-size: 14px; + line-height: 16px; + text-decoration: none; + border-radius: 5px; + font-weight: 700; + position: relative; + background-color: $white; + color: $main-color; + box-sizing: border-box; + border: 1px solid $main-color; + } } diff --git a/src/styles/stars.scss b/src/styles/stars.scss new file mode 100644 index 0000000000..1b60b59774 --- /dev/null +++ b/src/styles/stars.scss @@ -0,0 +1,18 @@ +.stars { + display: flex; + + &__star { + background-image: url(../images/star.svg); + background-position: 50%; + background-repeat: no-repeat; + width: 16px; + height: 16px; + border-radius: 0.5px; + gap: 4px; + 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..428e465464 --- /dev/null +++ b/src/styles/variables.scss @@ -0,0 +1,6 @@ +$hover-text-color: #34568b; +$main-color: #00acdc; +$text-color: #060b35; +$dark-gray: #616070; +$white: #fff; +$grey: #f3f3f3;