From ce3e66775bf2bea87be3d14429476653d2243517 Mon Sep 17 00:00:00 2001 From: Yuliia Date: Mon, 9 Dec 2024 20:44:21 +0200 Subject: [PATCH] add task solution --- readme.md | 12 +- src/index.html | 427 +++++++++++++++++- src/styles/blocks/card.scss | 104 +++++ src/styles/blocks/catalog.scss | 26 ++ src/styles/blocks/header.scss | 29 ++ src/styles/blocks/mixins-variables-fonts.scss | 26 ++ src/styles/blocks/nav.scss | 29 ++ src/styles/blocks/stars-block.scss | 31 ++ src/styles/index.scss | 13 + 9 files changed, 689 insertions(+), 8 deletions(-) create mode 100644 src/styles/blocks/card.scss create mode 100644 src/styles/blocks/catalog.scss create mode 100644 src/styles/blocks/header.scss create mode 100644 src/styles/blocks/mixins-variables-fonts.scss create mode 100644 src/styles/blocks/nav.scss create mode 100644 src/styles/blocks/stars-block.scss diff --git a/readme.md b/readme.md index 874ca70d97..5af3754d47 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,6 @@ # Frontend practice with catalog page -Create an HTML page with a catalog. Develop semantic page structure as shown on [the mockup](https://www.figma.com/file/ojkArVazq7vsX0nbpn9CxZ/Moyo-%2F-Catalog-(ENG)?node-id=32249%3A354). +Create an HTML page with a catalog. Develop semantic page structure as shown on [the mockup](). - use `Header`, `Stars` and `Card` blocks from previous tasks but rewrite them using BEM and SCSS - remove old `data-qa` attributes @@ -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` @@ -20,6 +20,7 @@ Create an HTML page with a catalog. Develop semantic page structure as shown on - cards container(catalog) have fixed paddings (`50px` vertically and `40px` horizontally) Make all the changes smooth on hover (during 300ms): + - increase the card by 20 percent (neighboring cards **should not be** affected) - change the card title text color to `#34568b` when the card is hovered (`.card:hover .card__title`) - change navigation link text color to `#00acdc` @@ -27,14 +28,15 @@ Make all the changes smooth on hover (during 300ms): > Here are the [Layout Tasks Instructions](https://mate-academy.github.io/layout_task-guideline) -*Important note*: In this task, you are allowed to link `*.scss` files directly in HTML `` tags using `href` attribute. +_Important note_: In this task, you are allowed to link `*.scss` files directly in HTML `` tags using `href` attribute. This is possible because [we use the Parcel library](https://en.parceljs.org/scss.html) to bundle your solution's source code. ## 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://julia303920201.github.io/layout_catalog/) +- [TEST REPORT LINK](https://julia303920201.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..ec03f5e900 100644 --- a/src/index.html +++ b/src/index.html @@ -2,26 +2,447 @@ + + Catalog + + + -

Catalog

+
+ + moyo + + + +
+ +
+
+
+ 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/blocks/card.scss b/src/styles/blocks/card.scss new file mode 100644 index 0000000000..0faadae286 --- /dev/null +++ b/src/styles/blocks/card.scss @@ -0,0 +1,104 @@ +@import 'stars-block'; + +.card { + width: 200px; + padding: 32px 16px 16px; + border: 1px solid #f3f3f3; + background: $white-color; + border-radius: 5px; + + transition: $transition-time all; + + &__img-cover { + width: 160px; + height: 134px; + margin: 0 auto; + + .card__img { + width: 100%; + height: 100%; + } + } + + &__title { + @include text-styling(12px, 500, 18px); + + transition: $transition-time all; + + margin-top: 40px; + margin-bottom: 0; + } + + &__descr { + @include text-styling(10px, 400, 14px); + + margin-top: 4px; + + color: $light-color; + } + + &__reviews { + @include text-styling(10px, 400, 14px); + + display: flex; + justify-content: space-between; + margin-top: 16px; + + .review-descr { + text-align: center; + display: flex; + justify-content: center; + align-items: center; + } + } + + &__price { + margin-top: 24px; + display: flex; + justify-content: space-between; + + .price-text { + @include text-styling(12px, 400, 18px); + + color: $light-color; + } + + .price-amount { + @include text-styling(16px, 700, 18px); + + font-weight: bold; + } + } + + &__button { + @include text-styling(14px, 700, 16px); + + width: 166px; + padding-block: 12px; + background: $blue-color; + border-radius: 5px; + border: 1px solid $blue-color; + margin-top: 16px; + color: $white-color; + + display: flex; + justify-content: center; + align-items: center; + + transition: $transition-time all; + cursor: pointer; + + &:hover { + background-color: $white-color; + color: $blue-color; + } + } + + &:hover { + transform: scale(1.2); + + .card__title { + color: #34568b; + } + } +} diff --git a/src/styles/blocks/catalog.scss b/src/styles/blocks/catalog.scss new file mode 100644 index 0000000000..d203b7b52e --- /dev/null +++ b/src/styles/blocks/catalog.scss @@ -0,0 +1,26 @@ +.catalog { + padding: 50px 40px; + display: grid; + justify-content: center; + gap: 46px 48px; +} + +@include media-mixin(1px, catalog, grid-template-columns, min-content); +@include media-mixin( + 488px, + catalog, + grid-template-columns, + repeat(2, min-content) +); +@include media-mixin( + 768px, + catalog, + grid-template-columns, + repeat(3, min-content) +); +@include media-mixin( + 1024px, + catalog, + grid-template-columns, + repeat(4, min-content) +); diff --git a/src/styles/blocks/header.scss b/src/styles/blocks/header.scss new file mode 100644 index 0000000000..21206dd6fb --- /dev/null +++ b/src/styles/blocks/header.scss @@ -0,0 +1,29 @@ +@import 'mixins-variables-fonts'; + +.header { + background-color: $white-color; + display: flex; + justify-content: space-between; + align-items: center; + padding: 0 50px; + + .logo-img { + width: 40px; + height: 40px; + } + + .is-active { + color: $blue-color; + + &::after { + content: ''; + display: block; + position: absolute; + bottom: 0; + width: 100%; + height: 4px; + background-color: $blue-color; + border-radius: 8px; + } + } +} diff --git a/src/styles/blocks/mixins-variables-fonts.scss b/src/styles/blocks/mixins-variables-fonts.scss new file mode 100644 index 0000000000..5eb42cef21 --- /dev/null +++ b/src/styles/blocks/mixins-variables-fonts.scss @@ -0,0 +1,26 @@ +$strong-color: #060b35; +$light-color: #616070; +$blue-color: #00acdc; +$white-color: #fff; +$black-color: #000; +$transition-time: 300ms; + +@mixin text-styling($size, $weight, $line-height) { + font-size: $size; + font-weight: $weight; + line-height: $line-height; +} + +@mixin media-mixin($screenSize, $selector, $prop, $value) { + @media (min-width: $screenSize) { + .#{$selector} { + #{$prop}: $value; + } + } +} + +@media (min-width: 768px) { + .catalog { + grid-template-columns: repeat(3, min-content); + } +} diff --git a/src/styles/blocks/nav.scss b/src/styles/blocks/nav.scss new file mode 100644 index 0000000000..e4e3f07ca9 --- /dev/null +++ b/src/styles/blocks/nav.scss @@ -0,0 +1,29 @@ +.nav { + &__list { + display: flex; + padding: 0; + margin-block: 0; + } + &__item { + list-style-type: none; + margin: 0 10px; + font-weight: 500; + position: relative; + } + &__list :first-child { + margin-left: 0; + } + &__list :last-child { + margin-right: 0; + } + &__link { + text-decoration: none; + font-size: 12px; + line-height: 60px; + color: $strong-color; + display: inline-block; + &:hover { + color: $blue-color; + } + } +} diff --git a/src/styles/blocks/stars-block.scss b/src/styles/blocks/stars-block.scss new file mode 100644 index 0000000000..ddc57c1887 --- /dev/null +++ b/src/styles/blocks/stars-block.scss @@ -0,0 +1,31 @@ +.stars { + display: flex; + + &__star { + width: 16px; + height: 16px; + margin-left: 4px; + background: center no-repeat url('../images/star.svg'); + display: inline-block; + + &:first-child { + margin-left: 0; + } + } + + &:first-child :nth-child(n) { + margin-top: 0; + } + + &:last-child :nth-child(n) { + margin-bottom: 0; + } +} + +.stars--1 :nth-child(-n + 1), +.stars--2 :nth-child(-n + 2), +.stars--3 :nth-child(-n + 3), +.stars--4 :nth-child(-n + 4), +.stars--5 :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..8fe3b9985c 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1,3 +1,16 @@ +@import 'blocks/header'; +@import 'blocks/mixins-variables-fonts'; +@import 'blocks/card'; +@import 'blocks/catalog'; +@import 'blocks/nav'; + +* { + margin: 0; + box-sizing: border-box; +} + body { margin: 0; + font-family: Roboto, Arial, Helvetica, sans-serif; + color: $strong-color; }