From 7bb44982970a5759fff9085a3401d6e0c2db95d7 Mon Sep 17 00:00:00 2001 From: Wilton Martins Date: Fri, 20 Dec 2024 23:45:48 -0300 Subject: [PATCH 1/2] add task solution --- readme.md | 8 +- src/index.html | 383 ++++++++++++++++++++++++++++++++++- src/styles/header.scss | 151 ++++++++++++++ src/styles/index.scss | 16 +- src/styles/product-card.scss | 144 +++++++++++++ src/styles/stars.scss | 26 +++ src/styles/variables.scss | 4 + 7 files changed, 725 insertions(+), 7 deletions(-) create mode 100644 src/styles/header.scss create mode 100644 src/styles/product-card.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..2a0d7f5317 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ -# Frontend practice with catalog page +wiltonmartinsdev# 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). @@ -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://wiltonmartinsdev.github.io/layout_catalog/) +- [TEST REPORT LINK](https://wiltonmartinsdev.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..10a8056e69 100644 --- a/src/index.html +++ b/src/index.html @@ -17,11 +17,390 @@ /> -

Catalog

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

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

+

Product code: 195434

+ +
+
+
+
+
+
+
+
+

Reviews: 5

+
+ +
+

Price:

+

$2,199

+
+ +
+ +
+
+ imac +
+

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

+

Product code: 195434

+ +
+
+
+
+
+
+
+
+

Reviews: 5

+
+ +
+

Price:

+

$2,199

+
+ +
+ +
+
+ imac +
+

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

+

Product code: 195434

+ +
+
+
+
+
+
+
+
+

Reviews: 5

+
+ +
+

Price:

+

$2,199

+
+ +
+ +
+
+ imac +
+

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

+

Product code: 195434

+ +
+
+
+
+
+
+
+
+

Reviews: 5

+
+ +
+

Price:

+

$2,199

+
+ +
+ +
+
+ imac +
+

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

+

Product code: 195434

+ +
+
+
+
+
+
+
+
+

Reviews: 5

+
+ +
+

Price:

+

$2,199

+
+ +
+ +
+
+ imac +
+

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

+

Product code: 195434

+ +
+
+
+
+
+
+
+
+

Reviews: 5

+
+ +
+

Price:

+

$2,199

+
+ +
+ +
+
+ imac +
+

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

+

Product code: 195434

+ +
+
+
+
+
+
+
+
+

Reviews: 5

+
+ +
+

Price:

+

$2,199

+
+ +
+ +
+
+ imac +
+

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

+

Product code: 195434

+ +
+
+
+
+
+
+
+
+

Reviews: 5

+
+ +
+

Price:

+

$2,199

+
+ +
+
+
diff --git a/src/styles/header.scss b/src/styles/header.scss new file mode 100644 index 0000000000..97d422b9bf --- /dev/null +++ b/src/styles/header.scss @@ -0,0 +1,151 @@ +@media screen and (max-width: 1024px) { + .header { + display: flex; + justify-content: space-between; + align-items: center; + + font-size: 12px; + font-weight: 500; + + text-transform: uppercase; + + padding: 0 50px; + + box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.05); + + &__logo { + display: flex; + align-items: center; + } + + &__menu { + display: flex; + list-style-type: none; + margin: 0; + padding: 0; + } + + &__menu-item { + margin-right: 20px; + + &:first-child { + margin-left: 0; + } + + &:last-child { + margin-right: 0; + } + } + + &__menu-link { + text-decoration: none; + text-transform: uppercase; + display: flex; + align-items: center; + height: 60px; + position: relative; + + color: $main-accent-color; + + transition: color 300ms ease; + + &:hover { + color: $blue-accent-color; + } + + &--active { + position: relative; + color: $blue-accent-color; + + &::after { + content: ''; + display: block; + width: 100%; + height: 4px; + background-color: $blue-accent-color; + position: absolute; + bottom: 0; + border-radius: 8px; + + transition: background-color 300ms ease; + } + } + } + } +} + +@media screen and (min-width: 1024px) { + .header { + display: flex; + justify-content: space-between; + align-items: center; + + font-size: 12px; + font-weight: 500; + + text-transform: uppercase; + + padding: 0 50px; + + box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.05); + + &__logo { + display: flex; + align-items: center; + } + + &__menu { + display: flex; + list-style-type: none; + margin: 0; + padding: 0; + } + + &__menu-item { + margin-right: 20px; + + &:first-child { + margin-left: 0; + } + + &:last-child { + margin-right: 0; + } + } + + &__menu-link { + text-decoration: none; + text-transform: uppercase; + display: flex; + align-items: center; + height: 60px; + position: relative; + + color: $main-accent-color; + + transition: color 300ms ease; + + &:hover { + color: $blue-accent-color; + } + + &.is-active { + position: relative; + color: $blue-accent-color; + + &::after { + content: ''; + display: block; + width: 100%; + height: 4px; + background-color: $blue-accent-color; + position: absolute; + bottom: 0; + border-radius: 8px; + + transition: background-color 300ms ease; + } + } + } + } +} diff --git a/src/styles/index.scss b/src/styles/index.scss index 293d3b1f13..e025bd92ba 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1,3 +1,17 @@ -body { +@import 'variables'; +@import 'header'; +@import 'product-card'; +@import 'stars'; + +* { margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + font-family: Roboto, sans-serif; + font-size: 16px; + + color: $main-accent-color; } diff --git a/src/styles/product-card.scss b/src/styles/product-card.scss new file mode 100644 index 0000000000..8fa98dcec5 --- /dev/null +++ b/src/styles/product-card.scss @@ -0,0 +1,144 @@ +.catalog { + display: grid; + grid-template-columns: 1fr; + gap: 48px 46px; + padding: 50px 40px; + + @media screen and (min-width: 488px) { + grid-template-columns: repeat(2, 1fr); + } + + @media screen and (min-width: 768px) { + grid-template-columns: repeat(3, 1fr); + } + + @media screen and (min-width: 1024px) { + grid-template-columns: repeat(4, 1fr); + } +} + +.product-card { + max-width: 200px; + min-height: 408px; + + padding: 32px 16px 16px; + + background-color: #fff; + color: $main-accent-color; + + border: 1px solid #f3f3f3; + border-radius: 5px; + + transition: transform 300ms ease; + + &__image-container { + display: flex; + justify-content: center; + + width: 100%; + + margin-bottom: 40px; + } + + &__image { + width: 160px; + height: 134px; + } + + &__title { + font-size: 12px; + font-weight: 500; + line-height: 18px; + text-align: left; + + margin-bottom: 4px; + } + + &__code { + font-size: 10px; + font-weight: 400; + line-height: 14px; + text-align: left; + + margin-top: 4px; + margin-bottom: 16px; + + color: $secondary-color; + } + + &__reviews { + display: flex; + justify-content: space-between; + align-items: center; + } + + &__price { + display: flex; + justify-content: space-between; + align-items: center; + + margin-top: 24px; + margin-bottom: 16px; + } + + &__reviews-text { + font-size: 10px; + font-weight: 400; + line-height: 14px; + + margin-left: 8px; + + color: $main-accent-color; + } + + &__price-label { + font-size: 12px; + line-height: 18px; + font-weight: 400; + + color: $secondary-color; + } + + &__price-value { + font-size: 16px; + line-height: 18px; + + font-weight: 700; + + color: $main-accent-color; + } + + &__buy-button { + width: 100%; + height: 40px; + + border-radius: 5px; + border: none; + + background: $blue-accent-color; + color: #fff; + + padding: 8px 16px; + + font-size: 14px; + line-height: 16px; + font-weight: 700; + text-decoration: none; + text-transform: uppercase; + + cursor: pointer; + + transition: all 300ms ease; + + &:hover { + background-color: #fff; + color: $blue-accent-color; + + border: 1px solid $blue-accent-color; + + transform: scale(1.2); + + z-index: 1; + } + } +} diff --git a/src/styles/stars.scss b/src/styles/stars.scss new file mode 100644 index 0000000000..d31c2d4274 --- /dev/null +++ b/src/styles/stars.scss @@ -0,0 +1,26 @@ +.stars { + display: flex; + align-items: center; + justify-content: space-around; + + height: 16px; + width: 96px; + + &__star { + width: 13px; + height: 12px; + margin-right: 5px; + background-image: url(../images/star.svg); + background-repeat: no-repeat; + background-position: center; + background-size: contain; + + &:last-child { + margin-right: 0; + } + + &: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..bc6321a4ae --- /dev/null +++ b/src/styles/variables.scss @@ -0,0 +1,4 @@ +$main-accent-color: #060b35; +$secondary-color: #616070; +$blue-accent-color: #00acdc; +$card-title-color: #34568b; From 91ab37e9c8daf18d8be79264081264e45b0a02f1 Mon Sep 17 00:00:00 2001 From: Wilton Martins Date: Fri, 20 Dec 2024 23:52:32 -0300 Subject: [PATCH 2/2] add task solution --- src/styles/header.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/styles/header.scss b/src/styles/header.scss index 97d422b9bf..1b25193b71 100644 --- a/src/styles/header.scss +++ b/src/styles/header.scss @@ -53,7 +53,7 @@ color: $blue-accent-color; } - &--active { + &.is-active { position: relative; color: $blue-accent-color;