diff --git a/readme.md b/readme.md index 874ca70d97..92ab3bf88e 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,20 +28,21 @@ 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://kwagfn.github.io/layout_catalog/) +- [TEST REPORT LINK](https://kwagfn.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..6a5b0778af 100644 --- a/src/index.html +++ b/src/index.html @@ -22,6 +22,449 @@ -

Catalog

+
+ + + + + +
+ +
+
+
+ Imac Image +
+ +
+

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

+ +

Product code: 195434

+ +
+
+
+
+
+
+
+
+

Reviews: 5

+
+ +

+ Price: + $2,199 +

+
+ + + Buy + +
+ +
+
+ Imac Image +
+ +
+

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

+ +

Product code: 195434

+ +
+
+
+
+
+
+
+
+

Reviews: 5

+
+ +

+ Price: + $2,199 +

+
+ + + Buy + +
+ +
+
+ Imac Image +
+ +
+

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

+ +

Product code: 195434

+ +
+
+
+
+
+
+
+
+

Reviews: 5

+
+ +

+ Price: + $2,199 +

+
+ + + Buy + +
+ +
+
+ Imac Image +
+ +
+

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

+ +

Product code: 195434

+ +
+
+
+
+
+
+
+
+

Reviews: 5

+
+ +

+ Price: + $2,199 +

+
+ + + Buy + +
+ +
+
+ Imac Image +
+ +
+

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

+ +

Product code: 195434

+ +
+
+
+
+
+
+
+
+

Reviews: 5

+
+ +

+ Price: + $2,199 +

+
+ + + Buy + +
+ +
+
+ Imac Image +
+ +
+

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

+ +

Product code: 195434

+ +
+
+
+
+
+
+
+
+

Reviews: 5

+
+ +

+ Price: + $2,199 +

+
+ + + Buy + +
+ +
+
+ Imac Image +
+ +
+

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

+ +

Product code: 195434

+ +
+
+
+
+
+
+
+
+

Reviews: 5

+
+ +

+ Price: + $2,199 +

+
+ + + Buy + +
+ +
+
+ Imac Image +
+ +
+

+ 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..89701835ae --- /dev/null +++ b/src/styles/card.scss @@ -0,0 +1,106 @@ +.card { + padding: 32px 16px 16px; + background-color: #fff; + border-radius: 5px; + border: 1px solid #f3f3f3; + display: flex; + width: 200px; + flex-direction: column; + align-items: center; + transition: transform 0.3s ease; + + &:hover { + transform: scale(1.2); + + &__details-name { + color: #34568b; + } + } + + &__product { + display: flex; + &-image { + width: 160px; + height: 134px; + } + } + + &__details { + margin: 40px 0 0; + &-name { + width: 166px; + font-size: 12px; + color: $primary-color-text; + font-weight: 500; + line-height: 18px; + } + + &-code { + margin: 4px 0 0; + font-size: 10px; + color: $secondary-color-text; + font-weight: 400; + } + + &-price { + margin: 24px 0 0; + font-size: 12px; + color: $secondary-color-text; + font-weight: 400; + display: flex; + justify-content: space-between; + align-items: center; + + span { + font-weight: 700; + font-size: 16px; + color: $primary-color-text; + } + } + } + + &__reviews { + margin: 16px 0 0; + display: flex; + justify-content: space-between; + align-items: center; + + &-stars { + display: flex; + margin: 0; + } + + &-count { + font-size: 10px; + color: $primary-color-text; + font-weight: 400; + } + } + + &__button-buy { + margin: 16px 0 0; + width: 100%; + height: 40px; + line-height: 16px; + background-color: $main-color; + text-decoration: none; + border-radius: 5px; + font-size: 14px; + font-weight: 700; + color: #fff; + text-transform: uppercase; + display: flex; + align-items: center; + justify-content: center; + + &[data-qa='card-hover'] { + transition: color 0.3s; + + &:hover { + color: $main-color; + background-color: #fff; + border: 1px solid $main-color; + } + } + } +} diff --git a/src/styles/globals.scss b/src/styles/globals.scss new file mode 100644 index 0000000000..69df081b32 --- /dev/null +++ b/src/styles/globals.scss @@ -0,0 +1,22 @@ +*, +*::before, +*::after { + padding: 0; + box-sizing: border-box; +} + +html { + font-family: Roboto, sans-serif; +} + +body { + margin: 0; +} + +p { + margin: 0; +} + +h1 { + margin: 0; +} diff --git a/src/styles/index.scss b/src/styles/index.scss index 293d3b1f13..516118bfbc 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1,3 +1,6 @@ -body { - margin: 0; -} +@import 'utils/variables'; +@import 'globals'; +@import 'navbar'; +@import 'main'; +@import 'card'; +@import 'star'; diff --git a/src/styles/main.scss b/src/styles/main.scss new file mode 100644 index 0000000000..8c5e230307 --- /dev/null +++ b/src/styles/main.scss @@ -0,0 +1,35 @@ +.main { + --column-count: 4; + + padding: 50px 40px; + display: grid; + grid-template-columns: repeat(var(--column-count), 1fr); + justify-content: center; + gap: 46px 48px; + max-width: fit-content; + margin: 0 auto; +} + +@media (min-width: 300px) { + .main { + --column-count: 1; + } +} + +@media (min-width: 488px) { + .main { + --column-count: 2; + } +} + +@media (min-width: 768px) { + .main { + --column-count: 3; + } +} + +@media (min-width: 1024px) { + .main { + --column-count: 4; + } +} diff --git a/src/styles/navbar.scss b/src/styles/navbar.scss new file mode 100644 index 0000000000..545e30d2e1 --- /dev/null +++ b/src/styles/navbar.scss @@ -0,0 +1,68 @@ +.header { + padding: 0 50px; + display: flex; + align-items: center; + justify-content: space-between; + + &__logo { + display: block; + } + + &__nav { + padding: 10px 0; + + &-items { + padding: 0; + display: flex; + align-items: center; + text-transform: uppercase; + font-size: 12px; + font-weight: 500; + } + + &-item { + text-align: center; + list-style: none; + margin: 0 10px; + + &:first-child { + margin-left: 0; + } + + &:last-child { + margin-right: 0; + } + } + + &-link { + text-decoration: none; + padding: 22.5px 0; + color: $primary-color-text; + transition: color 0.5s; + + &:hover { + color: $main-color; + } + } + } +} + +[data-qa='nav-hover']:hover { + color: $main-color; +} + +a.is-active { + position: relative; + color: $main-color; + + &::after { + content: ''; + position: absolute; + display: block; + width: 100%; + height: 4px; + border-radius: 8px; + bottom: -1px; + background-color: $main-color; + } +} diff --git a/src/styles/star.scss b/src/styles/star.scss new file mode 100644 index 0000000000..fba19586f3 --- /dev/null +++ b/src/styles/star.scss @@ -0,0 +1,12 @@ +.star { + background-image: url(../images/star.svg); + width: 16px; + height: 16px; + background-repeat: no-repeat; + background-position: center; + margin-right: 4px; +} + +.card__reviews-stars--4 .star:nth-child(-n + 4) { + background-image: url(../images/star-active.svg); +} diff --git a/src/styles/utils/variables.scss b/src/styles/utils/variables.scss new file mode 100644 index 0000000000..0b465d963a --- /dev/null +++ b/src/styles/utils/variables.scss @@ -0,0 +1,3 @@ +$primary-color-text: #060b35; +$secondary-color-text: #616070; +$main-color: #00acdc;