diff --git a/readme.md b/readme.md index 874ca70d97..a4c861184a 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,14 +33,14 @@ 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://lolekmakso.github.io/layout_catalog/) +- [TEST REPORT LINK](https://lolekmakso.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. -- [ ] All components follow BEM and use SCSS -- [ ] Repeated sizes and special colors are put to variables -- [ ] Grid is used for the columns -- [ ] Cards are shown in 1, 2, 3, or 4 columns based on screen resolution -- [ ] All changes on `:hover` are smooth -- [ ] Code follows all the [Code Style Rules ❗️](https://mate-academy.github.io/layout_task-guideline/html-css-code-style-rules) +- [x] All components follow BEM and use SCSS +- [x] Repeated sizes and special colors are put to variables +- [x] Grid is used for the columns +- [x] Cards are shown in 1, 2, 3, or 4 columns based on screen resolution +- [x] All changes on `:hover` are smooth +- [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 9cff78eeb7..a0eb23a556 100644 --- a/src/index.html +++ b/src/index.html @@ -22,6 +22,319 @@ -

Catalog

+
+ + +
+
+
+ APPLE A1419 iMac 27 Retina +
+

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

+

Product code: 195434

+
+
+
+
+
+
+
+
+
+

Reviews: 5

+
+
+

Price:

+

$2,199

+
+ +
+
+ APPLE A1419 iMac 27 Retina +
+

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

+

Product code: 195434

+
+
+
+
+
+
+
+
+
+

Reviews: 5

+
+
+

Price:

+

$2,199

+
+ +
+
+ APPLE A1419 iMac 27 Retina +
+

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

+

Product code: 195434

+
+
+
+
+
+
+
+
+
+

Reviews: 5

+
+
+

Price:

+

$2,199

+
+ +
+
+ APPLE A1419 iMac 27 Retina +
+

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

+

Product code: 195434

+
+
+
+
+
+
+
+
+
+

Reviews: 5

+
+
+

Price:

+

$2,199

+
+ +
+
+ APPLE A1419 iMac 27 Retina +
+

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

+

Product code: 195434

+
+
+
+
+
+
+
+
+
+

Reviews: 5

+
+
+

Price:

+

$2,199

+
+ +
+
+ APPLE A1419 iMac 27 Retina +
+

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

+

Product code: 195434

+
+
+
+
+
+
+
+
+
+

Reviews: 5

+
+
+

Price:

+

$2,199

+
+ +
+
+ APPLE A1419 iMac 27 Retina +
+

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

+

Product code: 195434

+
+
+
+
+
+
+
+
+
+

Reviews: 5

+
+
+

Price:

+

$2,199

+
+ +
+
+ APPLE A1419 iMac 27 Retina +
+

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

+

Product code: 195434

+
+
+
+
+
+
+
+
+
+

Reviews: 5

+
+
+

Price:

+

$2,199

+
+ +
+
diff --git a/src/styles/blocks/card.scss b/src/styles/blocks/card.scss new file mode 100644 index 0000000000..bfb549393a --- /dev/null +++ b/src/styles/blocks/card.scss @@ -0,0 +1,121 @@ +.card { + background-color: $white-color; + border: 1px solid $gray-elements-color; + border-radius: 5px; + padding: 32px 0 16px; + padding-inline: 16px; + width: $card-width; + + transition: + transform 300ms, + color 300ms, + background 300ms; + + &:hover { + transform: scale(110%); + } + + &__img { + display: flex; + justify-content: center; + align-items: center; + margin: 0 auto 40px; + width: 160px; + height: 134px; + background-position: center; + } + + &__description { + display: flex; + flex-direction: column; + gap: 4px; + padding-bottom: 16px; + } + + &__title { + text-decoration: none; + color: $main-color; + font-size: 12px; + font-weight: $medium-weight; + line-height: 18px; + transition: color 300ms; + } + + &:hover .card__title { + color: #34568b; + } + + &__code { + font-size: 10px; + line-height: 14px; + font-style: normal; + font-weight: $regular-weight; + color: $secondary-color; + } + + &__reviews { + display: flex; + justify-content: space-between; + align-items: flex-end; + margin-bottom: 24px; + width: 100%; + } + + &__reviews-count { + line-height: 14px; + font-size: 10px; + font-style: normal; + font-weight: $regular-weight; + color: $main-color; + display: block; + } + + &__price { + display: flex; + align-items: flex-end; + justify-content: space-between; + margin-bottom: 16px; + width: 100%; + } + + &__price-text { + line-height: 18px; + font-size: 12px; + font-weight: $regular-weight; + color: $secondary-color; + } + + &__dollar { + font-size: 16px; + font-weight: $bold-weight; + line-height: 18px; + color: $main-color; + } + + &__button { + height: 40px; + width: 100%; + padding-block: 12px; + display: block; + border-radius: 5px; + background: $blue-color; + border: 1px solid $blue-color; + color: $white-color; + text-decoration: none; + flex-shrink: 0; + font-size: 14px; + font-weight: $bold-weight; + line-height: 16px; + text-transform: uppercase; + font-family: inherit; + transition: + background 300ms, + color 300ms; + } + + &:hover .card__button { + background: $white-color; + border: 1px solid $blue-color; + color: $blue-color; + } +} diff --git a/src/styles/blocks/container.scss b/src/styles/blocks/container.scss new file mode 100644 index 0000000000..2853603fda --- /dev/null +++ b/src/styles/blocks/container.scss @@ -0,0 +1,19 @@ +.container { + display: grid; + gap: 46px 48px; + grid-template-columns: repeat(1, $card-width); + justify-content: center; + padding: 50px 40px; + + @media (min-width: 488px) { + grid-template-columns: repeat(2, $card-width); + } + + @media (min-width: 768px) { + grid-template-columns: repeat(3, $card-width); + } + + @media (min-width: 1024px) { + grid-template-columns: repeat(4, $card-width); + } +} diff --git a/src/styles/blocks/header.scss b/src/styles/blocks/header.scss new file mode 100644 index 0000000000..5a0729a1a2 --- /dev/null +++ b/src/styles/blocks/header.scss @@ -0,0 +1,14 @@ +.header { + display: flex; + justify-content: space-between; + align-items: center; + background-color: #fff; + padding: 0 50px; + font-size: 12px; + font-weight: $medium-weight; +} + +.logo { + width: 40px; + height: 40px; +} diff --git a/src/styles/blocks/nav.scss b/src/styles/blocks/nav.scss new file mode 100644 index 0000000000..d3999f5163 --- /dev/null +++ b/src/styles/blocks/nav.scss @@ -0,0 +1,46 @@ +.nav__list { + display: flex; + padding: 0; + margin: 0; + height: 60px; +} + +.nav__item { + display: inline-block; + list-style: none; +} + +.nav__item:not(:last-child) { + margin-right: 20px; +} + +.nav__link { + position: relative; + display: block; + padding: 23px 0; + text-decoration: none; + color: #060b35; + text-transform: uppercase; +} + +.nav__link.is-active, +.nav__link:hover { + color: $blue-color; +} + +.nav__link.is-active::after { + display: block; + content: ''; + position: absolute; + width: 100%; + height: 4px; + background-color: $blue-color; + bottom: 0; + right: 0; + left: 0; + border-radius: 8px; +} + +.is-active { + position: relative; +} diff --git a/src/styles/blocks/stars.scss b/src/styles/blocks/stars.scss new file mode 100644 index 0000000000..f852b3d9f6 --- /dev/null +++ b/src/styles/blocks/stars.scss @@ -0,0 +1,24 @@ +.stars { + display: flex; + + &__star { + width: 16px; + height: 16px; + margin-right: 4px; + background-image: url(./../images/star.svg); + background-repeat: no-repeat; + background-position: center; + } + + &__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(./../images/star-active.svg); +} diff --git a/src/styles/index.scss b/src/styles/index.scss index 293d3b1f13..8288063e95 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1,3 +1,7 @@ -body { - margin: 0; -} +@import 'utilis/base'; +@import 'utilis/variables'; +@import 'blocks/container'; +@import 'blocks/nav'; +@import 'blocks/card'; +@import 'blocks/header'; +@import 'blocks/stars'; diff --git a/src/styles/utilis/base.scss b/src/styles/utilis/base.scss new file mode 100644 index 0000000000..517d4d0647 --- /dev/null +++ b/src/styles/utilis/base.scss @@ -0,0 +1,15 @@ +* { + box-sizing: border-box; +} + +html { + font-family: Roboto, sans-serif; +} + +body, +h2, +p, +div { + margin: 0; + padding: 0; +} diff --git a/src/styles/utilis/variables.scss b/src/styles/utilis/variables.scss new file mode 100644 index 0000000000..df1e0efe55 --- /dev/null +++ b/src/styles/utilis/variables.scss @@ -0,0 +1,9 @@ +$main-color: #060b35; +$white-color: #fff; +$blue-color: #00acdc; +$secondary-color: #616070; +$gray-elements-color: #f3f3f3; +$card-width: 200px; +$regular-weight: 400; +$medium-weight: 500; +$bold-weight: 700;