diff --git a/readme.md b/readme.md index 874ca70d97..573be746d7 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://Pamcik.github.io/layout_catalog/) +- [TEST REPORT LINK](https://Pamcik.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..9762b1d190 100644 --- a/src/index.html +++ b/src/index.html @@ -22,6 +22,364 @@ -

Catalog

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

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

+

Product code: 195434

+
+
+
+
+
+
+
+
+ Reviews: 5 +
+
+ Price: + $2,199 +
+ + BUY + +
+
+ +
+ APPLE A1419 iMac 27'' Retina +
+

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

+

Product code: 195434

+
+
+
+
+
+
+
+
+ Reviews: 5 +
+
+ Price: + $2,199 +
+ + BUY + +
+
+ +
+ APPLE A1419 iMac 27'' Retina +
+

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

+

Product code: 195434

+
+
+
+
+
+
+
+
+ Reviews: 5 +
+
+ Price: + $2,199 +
+ + BUY + +
+
+ +
+ APPLE A1419 iMac 27'' Retina +
+

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

+

Product code: 195434

+
+
+
+
+
+
+
+
+ Reviews: 5 +
+
+ Price: + $2,199 +
+ + BUY + +
+
+ +
+ APPLE A1419 iMac 27'' Retina +
+

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

+

Product code: 195434

+
+
+
+
+
+
+
+
+ Reviews: 5 +
+
+ Price: + $2,199 +
+ + BUY + +
+
+ +
+ APPLE A1419 iMac 27'' Retina +
+

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

+

Product code: 195434

+
+
+
+
+
+
+
+
+ Reviews: 5 +
+
+ Price: + $2,199 +
+ + BUY + +
+
+ +
+ APPLE A1419 iMac 27'' Retina +
+

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

+

Product code: 195434

+
+
+
+
+
+
+
+
+ Reviews: 5 +
+
+ Price: + $2,199 +
+ + BUY + +
+
+ +
+ APPLE A1419 iMac 27'' Retina +
+

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

+

Product code: 195434

+
+
+
+
+
+
+
+
+ Reviews: 5 +
+
+ Price: + $2,199 +
+ + BUY + +
+
+
diff --git a/src/styles/_mixins.scss b/src/styles/_mixins.scss new file mode 100644 index 0000000000..0a647d65d2 --- /dev/null +++ b/src/styles/_mixins.scss @@ -0,0 +1,6 @@ +@mixin font-style($size, $weight, $line-height) { + font-family: Roboto, sans-serif; + font-size: $size; + font-weight: $weight; + line-height: $line-height; +} diff --git a/src/styles/_variables.scss b/src/styles/_variables.scss new file mode 100644 index 0000000000..f6e05c3b87 --- /dev/null +++ b/src/styles/_variables.scss @@ -0,0 +1,30 @@ +// colors + +$primary-color: #00acdc; +$secondary-color: #060b35; +$neutral-light: #f3f3f3; +$neutral-dark: #616070; +$white: white; +$title-color-hover: #34568b; + +// catalog +$gap-catalog: 46px 48px; +$catalog-padding: 50px 40px; + +// card +$card-width: 200px; +$image-height: 134px; +$image-padding-top: 16px; +$image-padding-sides: 19px; +$image-width: 160px; +$element-padding: 16px; +$card-title-padding-bottom: 4px; +$product-code-rating-padding: 16px; +$rating-price-spacing: 24px; +$price-button-spacing: 16px; +$button-width: 157px; +$border-radius: 5px; + +// stars +$stars-size: 16px; +$stars-margin: 4px; diff --git a/src/styles/card.scss b/src/styles/card.scss new file mode 100644 index 0000000000..dada373a8c --- /dev/null +++ b/src/styles/card.scss @@ -0,0 +1,113 @@ +@use './variables' as *; +@use './mixins' as *; + +.card { + box-sizing: border-box; + width: $card-width; + border: 1px solid $neutral-light; + border-radius: $border-radius; + font-family: Roboto, sans-serif; + display: flex; + flex-direction: column; + align-items: center; + padding: $element-padding; + + &__image { + max-width: $image-width; + height: $image-height; + padding: $image-padding-top $image-padding-sides 0; + } + + &__content { + display: flex; + flex-direction: column; + } + + &__title { + @include font-style(12px, 500, 18px); + + color: $secondary-color; + padding-top: 40px; + padding-bottom: $card-title-padding-bottom; + } + + &__code { + @include font-style(10px, 400, 14px); + + text-align: left; + color: $neutral-dark; + padding-bottom: $product-code-rating-padding; + } + + &__rating { + display: flex; + white-space: nowrap; + justify-content: space-between; + padding-bottom: $rating-price-spacing; + } + + &__reviews { + @include font-style(10px, 400, 14px); + + text-align: right; + color: $secondary-color; + } + + &__price { + @include font-style(12px, 400, 18px); + + display: flex; + justify-content: space-between; + color: $neutral-dark; + padding-bottom: $price-button-spacing; + + &-value { + @include font-style(16px, 700, 18px); + + color: $secondary-color; + } + } + + &__button { + display: flex; + align-items: center; + justify-content: center; + max-width: $button-width; + height: 24px; + background-color: $primary-color; + color: $white; + text-decoration: none; + text-align: center; + border-radius: $border-radius; + padding: 8px 16px; + + @include font-style(14px, bold, 16px); + + &:hover { + background-color: transparent; + color: $primary-color; + border: 1px solid $primary-color; + height: 23px; + } + } + + &[data-qa='card'] { + transition: + transform 300ms ease, + box-shadow 300ms ease; + + &:hover { + transform: scale(1.2); + } + + &:hover .card__title { + color: $title-color-hover; + } + + &:hover .card__button { + background-color: #fff; + color: #00acdc; + border: 1px solid #00acdc; + } +} +} diff --git a/src/styles/catalog.scss b/src/styles/catalog.scss new file mode 100644 index 0000000000..c8930a4890 --- /dev/null +++ b/src/styles/catalog.scss @@ -0,0 +1,22 @@ +@use './variables' as *; +@use './mixins' as *; + +.catalog { + display: grid; + gap: $gap-catalog; + grid-template-columns: 1fr; + justify-content: center; + padding: $catalog-padding; + + @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/header.scss b/src/styles/header.scss new file mode 100644 index 0000000000..3937df5589 --- /dev/null +++ b/src/styles/header.scss @@ -0,0 +1,71 @@ +@use './variables' as *; +@use './mixins' as *; + +.header { + width: 100%; + display: flex; + justify-content: space-between; + align-items: center; + padding: 0 50px; + box-sizing: border-box; + + &__logo { + width: 40px; + height: 40px; + margin-right: 20px; + } + + &__nav { + &-list { + list-style-type: none; + display: flex; + margin: 0; + padding: 0; + } + + &-item { + margin-right: 20px; + + &:first-child { + margin-left: 0; + } + + &:last-child { + margin-right: 0; + } + } + + &-link { + text-transform: uppercase; + height: 60px; + line-height: 60px; + text-decoration: none; + color: $secondary-color; + font-weight: 500; + display: flex; + align-items: center; + justify-content: center; + position: relative; + + &[data-qa='nav-hover']:hover { + color: $primary-color; + } + } + + .is-active { + color: $primary-color; + + &::after { + content: ''; + display: block; + height: 4px; + width: 100%; + border-radius: 8px; + background-color: $primary-color; + position: absolute; + bottom: 0; + left: 0; + } + } + } +} diff --git a/src/styles/index.scss b/src/styles/index.scss index 293d3b1f13..04f327969d 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1,3 +1,5 @@ -body { - margin: 0; -} +@use './main.scss'; +@use './header.scss'; +@use './catalog.scss'; +@use './card.scss'; +@use './stars.scss'; diff --git a/src/styles/main.scss b/src/styles/main.scss new file mode 100644 index 0000000000..c1e557c49b --- /dev/null +++ b/src/styles/main.scss @@ -0,0 +1,14 @@ +@use './variables' as *; +@use './mixins' as *; + +* { + margin: 0; + padding: 0; +} + +body { + margin: 0; + overflow-x: hidden; + + @include font-style(12px, 500, 18px); +} diff --git a/src/styles/stars.scss b/src/styles/stars.scss new file mode 100644 index 0000000000..4e905a07b1 --- /dev/null +++ b/src/styles/stars.scss @@ -0,0 +1,24 @@ +@use './variables' as *; +@use './mixins' as *; + +.stars { + display: flex; + align-items: center; + + &__star { + height: $stars-size; + width: $stars-size; + background-image: url('../images/star.svg'); + margin-right: $stars-margin; + background-position: center; + background-repeat: no-repeat; + } + + &--1 .stars__star:nth-child(-n + 1), + &--2 .stars__star:nth-child(-n + 2), + &--3 .stars__star:nth-child(-n + 3), + &--4 .stars__star:nth-child(-n + 4), + &--5 .stars__star:nth-child(-n + 5) { + background-image: url('../images/star-active.svg'); + } +}