diff --git a/readme.md b/readme.md index acd5174814..8a52f7c2ec 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://Tryzub-web.github.io/layout_catalog/) +- [TEST REPORT LINK](https://Tryzub-web.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..b21a29e87d 100644 --- a/src/index.html +++ b/src/index.html @@ -1,5 +1,8 @@ - + - -

Catalog

+ +
+ + + +
+ +
+
+
+ I-mac +
+ +

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

+ +
Product code: 195434
+ +
+
+
+
+
+
+
+
+ +
Reviews: 5
+
+ +
+
Price:
+
$2,199
+
+ + + Buy + +
+
+
+ I-mac +
+ +

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

+ +
Product code: 195434
+ +
+
+
+
+
+
+
+
+ +
Reviews: 5
+
+ +
+
Price:
+
$2,199
+
+ + + Buy + +
+
+
+ I-mac +
+ +

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

+ +
Product code: 195434
+ +
+
+
+
+
+
+
+
+ +
Reviews: 5
+
+ +
+
Price:
+
$2,199
+
+ + + Buy + +
+
+
+ I-mac +
+ +

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

+ +
Product code: 195434
+ +
+
+
+
+
+
+
+
+ +
Reviews: 5
+
+ +
+
Price:
+
$2,199
+
+ + + Buy + +
+
+
+ I-mac +
+ +

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

+ +
Product code: 195434
+ +
+
+
+
+
+
+
+
+ +
Reviews: 5
+
+ +
+
Price:
+
$2,199
+
+ + + Buy + +
+
+
+ I-mac +
+ +

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

+ +
Product code: 195434
+ +
+
+
+
+
+
+
+
+ +
Reviews: 5
+
+ +
+
Price:
+
$2,199
+
+ + + Buy + +
+
+
+ I-mac +
+ +

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

+ +
Product code: 195434
+ +
+
+
+
+
+
+
+
+ +
Reviews: 5
+
+ +
+
Price:
+
$2,199
+
+ + + Buy + +
+
+
+ I-mac +
+ +

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

+ +
Product code: 195434
+ +
+
+
+
+
+
+
+
+ +
Reviews: 5
+
+ +
+
Price:
+
$2,199
+
+ + + Buy + +
+
+
+ I-mac +
+ +

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

+ +
Product code: 195434
+ +
+
+
+
+
+
+
+
+ +
Reviews: 5
+
+ +
+
Price:
+
$2,199
+
+ + + Buy + +
+
+
+ I-mac +
+ +

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

+ +
Product code: 195434
+ +
+
+
+
+
+
+
+
+ +
Reviews: 5
+
+ +
+
Price:
+
$2,199
+
+ + + Buy + +
+
+
+ I-mac +
+ +

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

+ +
Product code: 195434
+ +
+
+
+
+
+
+
+
+ +
Reviews: 5
+
+ +
+
Price:
+
$2,199
+
+ + + Buy + +
+
+
+ I-mac +
+ +

+ 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..0aff9e59b3 --- /dev/null +++ b/src/styles/blocks/card.scss @@ -0,0 +1,99 @@ +@use '../utils/variables'; + +.card { + border: 1px solid #f3f3f3; + border-radius: 5px; + padding: 32px 16px 16px; + transition: transform variables.$time-transition linear; + background-color: #fff; + position: relative; + + &__title { + font-size: 12px; + line-height: 18px; + font-weight: 500; + margin-top: 40px; + padding: 0; + margin-bottom: 0; + transition: color variables.$time-transition linear; + } + + &:hover { + transform: scale(1.2); + z-index: 1; + + .card__title { + color: #34568b; + } + } + + &__image { + padding-inline: 3px; + img { + display: block; + width: 100%; + height: 134px; + object-fit: contain; + } + } + + &__code { + font-size: 10px; + color: variables.$main-second-color; + margin-top: 4px; + line-height: 14px; + } + + &__reviews { + display: flex; + justify-content: space-between; + align-items: center; + margin: 16px 0 24px; + font-size: 10px; + line-height: 14px; + } + + &__price { + display: flex; + justify-content: space-between; + + div { + line-height: 18px; + + &:first-child { + font-size: 12px; + color: variables.$main-second-color; + } + + &:last-child { + font-size: 16px; + font-weight: 700; + } + } + } + + &__buy { + display: flex; + height: 40px; + align-items: center; + justify-content: center; + margin: 16px auto 0; + padding: 0; + border-radius: 5px; + border: 1px solid variables.$btn-border-color; + text-decoration: none; + color: #fff; + background-color: variables.$btn-border-color; + font-size: 14px; + font-weight: 700; + transition: all 0.3s ease-in-out; + text-transform: uppercase; + line-height: 16px; + box-sizing: border-box; + + &:hover { + background-color: #fff; + color: variables.$btn-border-color; + } + } +} diff --git a/src/styles/blocks/header.scss b/src/styles/blocks/header.scss new file mode 100644 index 0000000000..becb941983 --- /dev/null +++ b/src/styles/blocks/header.scss @@ -0,0 +1,69 @@ +@use '../utils/variables'; + +.main-header { + max-width: 100%; + background-color: #fff; + display: flex; + justify-content: space-between; + align-items: center; + padding: 0 50px; + margin: 0 auto; + + &__logo { + img { + display: block; + margin: 0; + } + } + + &__menu { + display: flex; + margin: 0; + padding: 0; + + li { + padding: 0; + list-style: none; + margin-right: 20px; + + &:last-child { + margin-right: 0; + } + } + + a { + font-size: 12px; + text-decoration: none; + color: #060b35; + display: flex; + align-items: center; + height: variables.$height-nav; + position: relative; + font-family: Roboto, sans-serif; + font-optical-sizing: auto; + font-weight: 500; + font-style: normal; + font-variation-settings: 'wdth' 100; + text-transform: uppercase; + + &:hover { + color: variables.$color-nav-active; + } + } + + .is-active { + color: variables.$color-nav-active; + + &::after { + position: absolute; + display: block; + content: ' '; + height: 4px; + width: 100%; + background-color: variables.$color-nav-active; + bottom: 0; + border-radius: 8px; + } + } + } +} diff --git a/src/styles/blocks/page.scss b/src/styles/blocks/page.scss new file mode 100644 index 0000000000..284f32df3f --- /dev/null +++ b/src/styles/blocks/page.scss @@ -0,0 +1,32 @@ +@use '../utils/variables'; +@use '../utils/mixins'; + +.page__body { + margin: 0; + font-family: Roboto, sans-serif; + font-optical-sizing: auto; + font-weight: 400; + font-style: normal; + color: variables.$main-text-color; + min-height: 100vh; +} + +.cards { + display: grid; + justify-content: center; + padding: 50px 40px; + grid-template-columns: repeat(1, variables.$cart-width); + gap: 46px 48px; + + @include mixins.on-small { + grid-template-columns: repeat(2, variables.$cart-width); + } + + @include mixins.on-middle { + grid-template-columns: repeat(3, variables.$cart-width); + } + + @include mixins.on-big { + grid-template-columns: repeat(4, variables.$cart-width); + } +} diff --git a/src/styles/blocks/stars.scss b/src/styles/blocks/stars.scss new file mode 100644 index 0000000000..d5ca1a0570 --- /dev/null +++ b/src/styles/blocks/stars.scss @@ -0,0 +1,22 @@ +@use '../utils/variables'; + +.stars { + display: flex; + gap: 4px; + + &__item { + width: variables.$star-size; + height: variables.$star-size; + background-image: url('../images/star.svg'); + background-repeat: no-repeat; + background-position: center; + background-size: contain; + border-radius: 0.5px; + } + + @for $i from 1 through 5 { + &--#{$i} .stars__item:nth-child(-n + #{$i}) { + background-image: url('../images/star-active.svg'); + } + } +} diff --git a/src/styles/index.scss b/src/styles/index.scss index 293d3b1f13..c45439db23 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1,3 +1,4 @@ -body { - margin: 0; -} +@import 'blocks/page'; +@import 'blocks/header'; +@import 'blocks/card'; +@import 'blocks/stars'; diff --git a/src/styles/utils/mixins.scss b/src/styles/utils/mixins.scss new file mode 100644 index 0000000000..f94541d9a9 --- /dev/null +++ b/src/styles/utils/mixins.scss @@ -0,0 +1,17 @@ +@mixin on-small() { + @media (min-width: 488px) { + @content; + } +} + +@mixin on-middle() { + @media (min-width: 768px) { + @content; + } +} + +@mixin on-big() { + @media (min-width: 1024px) { + @content; + } +} diff --git a/src/styles/utils/variables.scss b/src/styles/utils/variables.scss new file mode 100644 index 0000000000..abc9f6e633 --- /dev/null +++ b/src/styles/utils/variables.scss @@ -0,0 +1,9 @@ +$carts-count-row-card: 1; +$cart-width: 200px; +$height-nav: 60px; +$color-nav-active: #00acdc; +$main-text-color: #060b35; +$main-second-color: #616070; +$btn-border-color: #00acdc; +$star-size: 16px; +$time-transition: 300ms;