diff --git a/readme.md b/readme.md index 874ca70d97..3aa8b1b43c 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://cementix.github.io/layout_catalog/) +- [TEST REPORT LINK](https://cementix.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..f455fc5b55 100644 --- a/src/index.html +++ b/src/index.html @@ -19,9 +19,405 @@ rel="stylesheet" href="styles/index.scss" /> + + -

Catalog

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

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

+

Product code: 195434

+
+
+ + + + + +
+

Reviews: 5

+
+
+

Price:

+

$2,199

+
+ + BUY + +
+
+
+
+ imac +

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

+

Product code: 195434

+
+
+ + + + + +
+

Reviews: 5

+
+
+

Price:

+

$2,199

+
+ + BUY + +
+
+
+
+ imac +

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

+

Product code: 195434

+
+
+ + + + + +
+

Reviews: 5

+
+
+

Price:

+

$2,199

+
+ + BUY + +
+
+
+
+ imac +

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

+

Product code: 195434

+
+
+ + + + + +
+

Reviews: 5

+
+
+

Price:

+

$2,199

+
+ + BUY + +
+
+
+
+ imac +

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

+

Product code: 195434

+
+
+ + + + + +
+

Reviews: 5

+
+
+

Price:

+

$2,199

+
+ + BUY + +
+
+
+
+ imac +

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

+

Product code: 195434

+
+
+ + + + + +
+

Reviews: 5

+
+
+

Price:

+

$2,199

+
+ + BUY + +
+
+
+
+ imac +

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

+

Product code: 195434

+
+
+ + + + + +
+

Reviews: 5

+
+
+

Price:

+

$2,199

+
+ + BUY + +
+
+
+
+ imac +

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

+

Product code: 195434

+
+
+ + + + + +
+

Reviews: 5

+
+
+

Price:

+

$2,199

+
+ + BUY + +
+
+
diff --git a/src/styles/grid.scss b/src/styles/grid.scss new file mode 100644 index 0000000000..61fa73c391 --- /dev/null +++ b/src/styles/grid.scss @@ -0,0 +1,19 @@ +.catalog { + display: grid; + gap: 46px 48px; + padding: 50px 40px; + align-items: center; + justify-content: center; + + @media (min-width: 488px) { + grid-template-columns: repeat(2, 200px); + } + + @media (min-width: 768px) { + grid-template-columns: repeat(3, 200px); + } + + @media (min-width: 1024px) { + grid-template-columns: repeat(4, 200px); + } +} diff --git a/src/styles/header.scss b/src/styles/header.scss new file mode 100644 index 0000000000..19803d1774 --- /dev/null +++ b/src/styles/header.scss @@ -0,0 +1,68 @@ +.header { + display: flex; + align-items: center; + justify-content: space-between; + background-color: $white; + font-weight: 500; + padding: 0 50px; + box-sizing: border-box; +} + +.logo { + height: 40px; + width: 40px; +} + +.nav__list { + display: flex; + margin: 0; + padding: 0; + list-style: none; +} + +.nav__item { + margin-right: 20px; +} + +.nav__link { + text-decoration: none; + color: $text-color; + line-height: 60px; + font-family: Roboto, sans-serif; + font-weight: 500; + text-transform: uppercase; + display: block; + text-align: center; + font-size: 12px; + transition: + color 0.3s ease, + background-color 0.3s ease; +} + +.nav__link.is-active { + color: $main-color; + position: relative; +} + +.nav__list:first-child { + margin-left: 0; +} + +.nav__list:last-child { + margin-right: 0; +} + +.nav__link:hover { + color: $main-color; +} + +.is-active::after { + content: ''; + position: absolute; + bottom: 0; + left: 0; + width: 100%; + height: 4px; + border-radius: 8px; + background-color: $main-color; +} diff --git a/src/styles/index.scss b/src/styles/index.scss index 293d3b1f13..444756edd3 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1,3 +1,123 @@ +@import './variables'; +@import './header'; +@import './stars'; +@import './grid'; + body { margin: 0; + font-family: Roboto, sans-serif; +} + +.product-card { + transition: transform 300ms ease-in-out; + box-sizing: border-box; + width: 200px; + background-color: $white; + border-radius: 5px; + border: 1px solid $grey; + padding: 32px 16px 16px; + background-position: center; + + &:hover { + transform: scale(1.1); + z-index: 10; + } + + &__image { + display: block; + margin: 0 auto 40px; + width: 160px; + height: 134px; + background-size: cover; + background-position: center; + } + + &__title { + display: flex; + font-size: 12px; + line-height: 18px; + font-weight: 500; + margin-bottom: 4px; + color: $text-color; + + &:hover { + color: $hover-text-color; + } + } + + &__description { + font-size: 10px; + line-height: 14px; + color: $dark-gray; + margin: 0 0 16px; + } +} + +.mark { + display: flex; + height: 16px; + margin-bottom: 24px; + justify-content: space-between; + align-items: center; + + &__reviews { + font-size: 10px; + line-height: 14px; + text-align: right; + font-weight: 400; + color: $text-color; + } +} + +.price { + display: flex; + justify-content: space-between; + margin-bottom: 16px; + + &__word { + font-size: 12px; + font-weight: 400; + line-height: 18px; + text-align: left; + color: $dark-gray; + margin: 0; + } + + &__numeric { + font-size: 16px; + font-weight: 700; + line-height: 18px; + text-align: right; + color: $text-color; + margin: 0; + } +} + +.bottom { + display: block; + text-align: center; + padding: 12px; + font-size: 14px; + line-height: 16px; + color: $white; + text-decoration: none; + border-radius: 5px; + font-weight: 700; + background-color: $main-color; + + &:hover { + display: block; + text-align: center; + padding: 12px; + font-size: 14px; + line-height: 16px; + text-decoration: none; + border-radius: 5px; + font-weight: 700; + position: relative; + background-color: $white; + color: $main-color; + box-sizing: border-box; + border: 1px solid $main-color; + } } diff --git a/src/styles/stars.scss b/src/styles/stars.scss new file mode 100644 index 0000000000..1b60b59774 --- /dev/null +++ b/src/styles/stars.scss @@ -0,0 +1,18 @@ +.stars { + display: flex; + + &__star { + background-image: url(../images/star.svg); + background-position: 50%; + background-repeat: no-repeat; + width: 16px; + height: 16px; + border-radius: 0.5px; + gap: 4px; + margin-right: 4px; + + &: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..428e465464 --- /dev/null +++ b/src/styles/variables.scss @@ -0,0 +1,6 @@ +$hover-text-color: #34568b; +$main-color: #00acdc; +$text-color: #060b35; +$dark-gray: #616070; +$white: #fff; +$grey: #f3f3f3;