diff --git a/readme.md b/readme.md index 874ca70d97..104dd9e2a7 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://kepchuk1234.github.io/layout_catalog/) +- [TEST REPORT LINK](https://kepchuk1234.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..286bdd3e75 100644 --- a/src/index.html +++ b/src/index.html @@ -1,5 +1,8 @@ - + - -

Catalog

+ + + +
+
+ iMac 27 + +

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

+ +

Product code: 195434

+ +
+
+
+
+
+
+
+
+ +

Reviews: 5

+
+ +
+

Price:

+ +

$2,199

+
+ + + Buy + +
+ +
+ iMac 27 + +

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

+ +

Product code: 195434

+ +
+
+
+
+
+
+
+
+ +

Reviews: 5

+
+ +
+

Price:

+ +

$2,199

+
+ + + Buy + +
+ +
+ iMac 27 + +

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

+ +

Product code: 195434

+ +
+
+
+
+
+
+
+
+ +

Reviews: 5

+
+ +
+

Price:

+ +

$2,199

+
+ + + Buy + +
+ +
+ iMac 27 + +

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

+ +

Product code: 195434

+ +
+
+
+
+
+
+
+
+ +

Reviews: 5

+
+ +
+

Price:

+ +

$2,199

+
+ + + Buy + +
+ +
+ iMac 27 + +

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

+ +

Product code: 195434

+ +
+
+
+
+
+
+
+
+ +

Reviews: 5

+
+ +
+

Price:

+ +

$2,199

+
+ + + Buy + +
+ +
+ iMac 27 + +

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

+ +

Product code: 195434

+ +
+
+
+
+
+
+
+
+ +

Reviews: 5

+
+ +
+

Price:

+ +

$2,199

+
+ + + Buy + +
+ +
+ iMac 27 + +

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

+ +

Product code: 195434

+ +
+
+
+
+
+
+
+
+ +

Reviews: 5

+
+ +
+

Price:

+ +

$2,199

+
+ + + Buy + +
+ +
+ iMac 27 + +

+ 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..b2dffd5044 --- /dev/null +++ b/src/styles/blocks/card.scss @@ -0,0 +1,95 @@ +.card { + box-sizing: border-box; + display: flex; + flex-direction: column; + align-items: center; + width: $card-width; + padding: 32px 16px 16px; + border: 1px solid #f3f3f3; + border-radius: 5px; + + font-family: Roboto, sans-serif; + color: $main-color; + + &__img { + height: 134px; + margin-bottom: 40px; + } + + &__title { + font-size: 12px; + font-weight: 500; + line-height: 18px; + margin: 0; + margin-bottom: 4px; + } + + &__code { + margin: 0; + margin-bottom: 16px; + align-self: flex-start; + + font-weight: 400; + font-size: 10px; + line-height: 14px; + color: $secondary-color; + } + + &__reviews { + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + width: 100%; + margin-bottom: 24px; + } + + &__reviews-text { + font-size: 10px; + line-height: 16px; + } + + &__price { + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + width: 100%; + margin-bottom: 16px; + } + + &__price-text { + font-size: 12px; + line-height: 18px; + color: $secondary-color; + } + + &__price-number { + font-size: 16px; + font-weight: 700; + line-height: 18px; + } + + &__link { + box-sizing: border-box; + width: 100%; + height: 40px; + + border: 1px solid $main-blue; + border-radius: 5px; + background-color: $main-blue; + color: #fff; + font-size: 14px; + font-weight: 700; + line-height: 40px; + text-transform: uppercase; + text-decoration: none; + text-align: center; + transition: all, $transition-duration; + + &:hover { + background-color: transparent; + color: $main-blue; + } + } +} diff --git a/src/styles/blocks/catalog.scss b/src/styles/blocks/catalog.scss new file mode 100644 index 0000000000..1911d12b6e --- /dev/null +++ b/src/styles/blocks/catalog.scss @@ -0,0 +1,20 @@ +.catalog { + display: grid; + grid-template-columns: repeat(1, $card-width); + gap: 46px 48px; + + padding: 50px 40px; + width: fit-content; + + @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/blocks/header.scss b/src/styles/blocks/header.scss new file mode 100644 index 0000000000..dcc9e48dc5 --- /dev/null +++ b/src/styles/blocks/header.scss @@ -0,0 +1,12 @@ +.header { + display: flex; + justify-content: space-between; + align-items: center; + padding: 0 50px; + box-shadow: 0 2px 4px 0 #0000000d; + + &__logo-link { + display: flex; + align-items: center; + } +} diff --git a/src/styles/blocks/nav.scss b/src/styles/blocks/nav.scss new file mode 100644 index 0000000000..006775a23d --- /dev/null +++ b/src/styles/blocks/nav.scss @@ -0,0 +1,40 @@ +.nav { + &__list { + display: flex; + gap: 20px; + justify-content: space-between; + margin: 0; + padding: 0; + list-style: none; + } + + &__link { + position: relative; + display: block; + text-decoration: none; + height: 60px; + line-height: 60px; + color: $main-color; + font-size: 12px; + font-weight: 500; + text-transform: uppercase; + + @include on-hover(color, $main-blue); + + &--is-active { + color: $main-blue; + + &::after { + position: absolute; + content: ''; + left: 0; + right: 0; + display: block; + border-radius: 8px; + height: 4px; + background-color: $main-blue; + transform: translateY(-100%); + } + } + } +} diff --git a/src/styles/blocks/page.scss b/src/styles/blocks/page.scss new file mode 100644 index 0000000000..d1d7024e42 --- /dev/null +++ b/src/styles/blocks/page.scss @@ -0,0 +1,13 @@ +.page { + font-family: Roboto, Arial, sans-serif; + + &__body { + margin: 0; + display: flex; + flex-direction: column; + } + + &__catalog { + align-self: center; + } +} diff --git a/src/styles/blocks/stars.scss b/src/styles/blocks/stars.scss new file mode 100644 index 0000000000..7614da92b6 --- /dev/null +++ b/src/styles/blocks/stars.scss @@ -0,0 +1,22 @@ +.stars { + display: flex; + + &__star { + width: 16px; + height: 16px; + + background-image: url(../images/star.svg); + background-repeat: no-repeat; + background-position: center; + + &:not(:last-child) { + margin-right: 4px; + } + } + + @for $i from 1 through 5 { + &--#{$i} .stars__star: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..f99613ef8f 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1,3 +1,13 @@ -body { +@import './utils/variables'; +@import './utils/mixins'; +@import './blocks/page'; +@import './blocks/header'; +@import './blocks/nav'; +@import './blocks/catalog'; +@import './blocks/card'; +@import './blocks/stars'; + +h2, +p { margin: 0; } diff --git a/src/styles/utils/mixins.scss b/src/styles/utils/mixins.scss new file mode 100644 index 0000000000..04e4b36a71 --- /dev/null +++ b/src/styles/utils/mixins.scss @@ -0,0 +1,7 @@ +@mixin on-hover($property, $value) { + transition: $property $transition-duration; + + &:hover { + #{$property}: $value; + } +} diff --git a/src/styles/utils/variables.scss b/src/styles/utils/variables.scss new file mode 100644 index 0000000000..87867d7700 --- /dev/null +++ b/src/styles/utils/variables.scss @@ -0,0 +1,5 @@ +$main-blue: #00acdc; +$main-color: #060b35; +$secondary-color: #616070; +$transition-duration: 0.3s; +$card-width: 200px;