diff --git a/readme.md b/readme.md index 874ca70d97..464d29aa1a 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,23 @@ 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://KrawczykDamiann + .github.io/layout_catalog/) +- [TEST REPORT LINK](https://KrawczykDamiann + .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..3df94d5af4 100644 --- a/src/index.html +++ b/src/index.html @@ -22,6 +22,428 @@ -

Catalog

+
+ + + + + +
+ +
+
+
+ Product + +
+
+ APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A) +
+
Product code: 195434
+
+ +
+
+
+
+
+
+
+
+
Reviews: 5
+
+ +
+
Price:
+
$2,199
+
+ + + buy + +
+ +
+ Product + +
+
+ APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A) +
+
Product code: 195434
+
+ +
+
+
+
+
+
+
+
+
Reviews: 5
+
+ +
+
Price:
+
$2,199
+
+ + + buy + +
+
+ Product + +
+
+ APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A) +
+
Product code: 195434
+
+ +
+
+
+
+
+
+
+
+
Reviews: 5
+
+ +
+
Price:
+
$2,199
+
+ + + buy + +
+
+ Product + +
+
+ APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A) +
+
Product code: 195434
+
+ +
+
+
+
+
+
+
+
+
Reviews: 5
+
+ +
+
Price:
+
$2,199
+
+ + + buy + +
+
+ Product + +
+
+ APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A) +
+
Product code: 195434
+
+ +
+
+
+
+
+
+
+
+
Reviews: 5
+
+ +
+
Price:
+
$2,199
+
+ + + buy + +
+
+ Product + +
+
+ APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A) +
+
Product code: 195434
+
+ +
+
+
+
+
+
+
+
+
Reviews: 5
+
+ +
+
Price:
+
$2,199
+
+ + + buy + +
+
+ Product + +
+
+ APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A) +
+
Product code: 195434
+
+ +
+
+
+
+
+
+
+
+
Reviews: 5
+
+ +
+
Price:
+
$2,199
+
+ + + buy + +
+
+ Product + +
+
+ APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A) +
+
Product code: 195434
+
+ +
+
+
+
+
+
+
+
+
Reviews: 5
+
+ +
+
Price:
+
$2,199
+
+ + + buy + +
+
+
diff --git a/src/styles/_button.scss b/src/styles/_button.scss new file mode 100644 index 0000000000..620211bf05 --- /dev/null +++ b/src/styles/_button.scss @@ -0,0 +1,24 @@ +.button { + @include center; + @include roboto700; + + height: 40px; + width: 100%; + margin-top: 16px; + border-radius: 5px; + border-color: 1px solid #00acdc; + text-decoration: none; + cursor: pointer; + font-size: 14px; + line-height: 16px; + text-transform: uppercase; + color: #fff; + background-color: #00acdc; + box-sizing: border-box; + + &:hover { + background-color: #fff; + border: 1px solid #00acdc; + color: #00acdc; + } +} diff --git a/src/styles/_card.scss b/src/styles/_card.scss new file mode 100644 index 0000000000..be86cb29df --- /dev/null +++ b/src/styles/_card.scss @@ -0,0 +1,46 @@ +.card { + @include center; + + box-sizing: border-box; + padding: 16px; + border: 1px solid #f3f3f3; + border-radius: 5px; + flex-direction: column; + width: 200px; + + &__image { + margin-top: 16px; + width: 160px; + height: 134px; + } + + &__title { + margin-top: 40px; + + &-text { + @include roboto500; + + font-size: 12px; + line-height: 18px; + color: #060b35; + } + + &-product-code { + @include roboto400; + + color: #616070; + font-size: 10px; + line-height: 14px; + margin-top: 4px; + } + } + + &:hover { + transform: scale(1.2); + transition: transform 300ms; + } + + &:hover .card__title-text { + color: #34568b; + } +} diff --git a/src/styles/_mixins.scss b/src/styles/_mixins.scss new file mode 100644 index 0000000000..c8d098bcd8 --- /dev/null +++ b/src/styles/_mixins.scss @@ -0,0 +1,23 @@ +@mixin center { + display: flex; + align-items: center; + justify-content: center; +} + +@mixin roboto400 { + font-family: Roboto, serif; + font-weight: 400; + font-style: normal; +} + +@mixin roboto500 { + font-family: Roboto, serif; + font-weight: 500; + font-style: normal; +} + +@mixin roboto700 { + font-family: Roboto, serif; + font-weight: 700; + font-style: normal; +} diff --git a/src/styles/_nav.scss b/src/styles/_nav.scss new file mode 100644 index 0000000000..823824ac25 --- /dev/null +++ b/src/styles/_nav.scss @@ -0,0 +1,31 @@ +.nav { + margin: 0; + padding: 0; + + &__list { + display: flex; + list-style: none; + height: 60px; + text-transform: uppercase; + } + + &__element { + margin-left: 20px; + } + + &__element:first-child { + margin-left: 0; + } + + &__link { + color: #060b35; + text-decoration: none; + font-size: 12px; + line-height: 60px; + display: inline-block; + } + + &__link:hover { + color: #00acdc; + } +} diff --git a/src/styles/_price.scss b/src/styles/_price.scss new file mode 100644 index 0000000000..d15a1ba7f4 --- /dev/null +++ b/src/styles/_price.scss @@ -0,0 +1,22 @@ +.price { + display: flex; + justify-content: space-between; + align-items: center; + margin-top: 24px; + width: 100%; + + &__text { + @include roboto400; + + color: #616070; + font-size: 12px; + } + + &__sum { + @include roboto700; + + color: #060b35; + line-height: 18px; + font-size: 16px; + } +} diff --git a/src/styles/_stars.scss b/src/styles/_stars.scss new file mode 100644 index 0000000000..e56eaf0d1c --- /dev/null +++ b/src/styles/_stars.scss @@ -0,0 +1,34 @@ +.stars { + display: flex; + justify-content: space-between; + align-items: flex-end; + line-height: 16px; + width: 100%; + margin-top: 16px; + + &__list { + @include center; + } + + &__star { + width: 16px; + height: 16px; + margin-right: 4px; + justify-content: space-between; + background-image: url('../images/star-active.svg'); + background-repeat: no-repeat; + } + + &__star:nth-child(n + 5) { + background-image: url('../images/star.svg'); + } + + &__reviews { + @include roboto400; + + justify-content: space-between; + line-height: 14px; + color: #060b35; + font-size: 10px; + } +} diff --git a/src/styles/_variables.scss b/src/styles/_variables.scss new file mode 100644 index 0000000000..e01282c336 --- /dev/null +++ b/src/styles/_variables.scss @@ -0,0 +1 @@ +$primary-width: 166px; diff --git a/src/styles/index.css b/src/styles/index.css new file mode 100644 index 0000000000..68bdf6705d --- /dev/null +++ b/src/styles/index.css @@ -0,0 +1,242 @@ +.nav { + margin: 0; + padding: 0; +} + +.nav__list { + display: flex; + list-style: none; + height: 60px; + text-transform: uppercase; +} + +.nav__element { + margin-left: 20px; +} + +.nav__element:first-child { + margin-left: 0; +} + +.nav__link { + color: #060b35; + text-decoration: none; + font-size: 12px; + line-height: 60px; + display: inline-block; +} + +.nav__link:hover { + color: #00acdc; +} + +.card { + display: flex; + align-items: center; + justify-content: center; + box-sizing: border-box; + padding: 16px; + border: 1px solid #f3f3f3; + border-radius: 5px; + flex-direction: column; + width: 200px; +} + +.card__image { + margin-top: 16px; + width: 160px; + height: 134px; +} + +.card__title { + margin-top: 40px; +} + +.card__title-text { + font-family: Roboto, serif; + font-weight: 500; + font-style: normal; + font-size: 12px; + line-height: 18px; + color: #060b35; +} + +.card__title-product-code { + font-family: Roboto, serif; + font-weight: 400; + font-style: normal; + color: #616070; + font-size: 10px; + line-height: 14px; + margin-top: 4px; +} + +.card:hover { + transform: scale(1.2); + transition: transform 300ms; +} + +.card:hover .card__title-text { + color: #34568b; +} + +.stars { + display: flex; + justify-content: space-between; + align-items: flex-end; + line-height: 16px; + width: 100%; + margin-top: 16px; +} + +.stars__list { + display: flex; + align-items: center; + justify-content: center; +} + +.stars__star { + width: 16px; + height: 16px; + margin-right: 4px; + justify-content: space-between; + background-image: url('../images/star-active.svg'); + background-repeat: no-repeat; +} + +.stars__star:nth-child(n + 5) { + background-image: url('../images/star.svg'); +} + +.stars__reviews { + font-family: Roboto, serif; + font-weight: 400; + font-style: normal; + justify-content: space-between; + line-height: 14px; + color: #060b35; + font-size: 10px; +} + +.price { + display: flex; + justify-content: space-between; + align-items: center; + margin-top: 24px; + width: 100%; +} + +.price__text { + font-family: Roboto, serif; + font-weight: 400; + font-style: normal; + color: #616070; + font-size: 12px; +} + +.price__sum { + font-family: Roboto, serif; + font-weight: 700; + font-style: normal; + color: #060b35; + line-height: 18px; + font-size: 16px; +} + +.button { + display: flex; + align-items: center; + justify-content: center; + font-family: Roboto, serif; + font-weight: 700; + font-style: normal; + height: 40px; + width: 100%; + margin-top: 16px; + border-radius: 5px; + border-color: 1px solid #00acdc; + text-decoration: none; + cursor: pointer; + font-size: 14px; + line-height: 16px; + text-transform: uppercase; + color: #fff; + background-color: #00acdc; + box-sizing: border-box; +} + +.button:hover { + background-color: #fff; + border: 1px solid #00acdc; + color: #00acdc; +} + +body { + margin: 0; + padding: 0; +} + +header { + font-family: Roboto, serif; + font-weight: 500; + font-style: normal; +} + +.header { + height: 60px; + margin: 0; + display: flex; + align-items: center; + justify-content: space-between; + width: 100vw; + padding: 0 50px; + background-color: #fff; + box-sizing: border-box; +} + +.is-active { + position: relative; + color: #00acdc; +} + +.is-active::after { + content: ''; + position: absolute; + bottom: 0; + left: 0; + right: 0; + height: 4px; + background-color: #00acdc; +} + +main { + font-family: Roboto, serif; + font-weight: 400; + font-style: normal; + padding: 50px 40px; +} + +.catalog { + justify-content: center; + display: grid; + grid-template-columns: repeat(1, 200px); + gap: 48px 46px; +} + +@media (min-width: 488px) { + .catalog { + grid-template-columns: repeat(2, 1fr); + } +} + +@media (min-width: 768px) { + .catalog { + grid-template-columns: repeat(3, 1fr); + } +} + +@media (min-width: 1024px) { + .catalog { + grid-template-columns: repeat(4, 1fr); + } +} diff --git a/src/styles/index.css.map b/src/styles/index.css.map new file mode 100644 index 0000000000..855d197210 --- /dev/null +++ b/src/styles/index.css.map @@ -0,0 +1 @@ +{"version":3,"sourceRoot":"","sources":["_nav.scss","_card.scss","_mixins.scss","_stars.scss","_price.scss","_button.scss","index.scss"],"names":[],"mappings":"AAAA;EACE;EACA;;AAEA;EACE;EACA;EACA;EACA;;AAGF;EACE;;AAGF;EACE;;AAGF;EACE;EACA;EACA;EACA;EACA;;AAGF;EACE;;;AC5BJ;ECCE;EACA;EACA;EDAA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;;AAGF;EACE;;AAEA;ECNF;EACA;EACA;EDOI;EACA;EACA;;AAGF;ECpBF;EACA;EACA;EDqBI;EACA;EACA;EACA;;AAIJ;EACE;EACA;;AAGF;EACE;;;AE3CJ;EACE;EACA;EACA;EACA;EACA;EACA;;AAEA;EDPA;EACA;EACA;;ACSA;EACE;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;;AAGF;EDlBA;EACA;EACA;ECmBE;EACA;EACA;EACA;;;AC/BJ;EACE;EACA;EACA;EACA;EACA;;AAEA;EFAA;EACA;EACA;EECE;EACA;;AAGF;EFKA;EACA;EACA;EEJE;EACA;EACA;;;ACnBJ;EHCE;EACA;EACA;EAgBA;EACA;EACA;EGjBA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;;;ACbJ;EACE;EACA;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;;AAIF;EJxCE;EACA;EACA;EIyCA;;;AAGF;EACE;EACA;EACA;EACA;;;AAGF;EACE;IACE;;;AAIJ;EACE;IACE;;;AAIJ;EACE;IACE","file":"index.css"} \ No newline at end of file diff --git a/src/styles/index.scss b/src/styles/index.scss index 293d3b1f13..5d48961dd8 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1,3 +1,77 @@ +@import './mixins'; +@import './variables'; +@import './nav'; +@import './card'; +@import './stars'; +@import './price'; +@import './button'; + body { margin: 0; + padding: 0; +} + +header { + font-family: Roboto, serif; + font-weight: 500; + font-style: normal; +} + +.header { + height: 60px; + margin: 0; + display: flex; + align-items: center; + justify-content: space-between; + width: 100vw; + padding: 0 50px; + background-color: #fff; + box-sizing: border-box; +} + +.is-active { + position: relative; + color: #00acdc; +} + +.is-active::after { + content: ''; + position: absolute; + bottom: 0; + left: 0; + right: 0; + height: 4px; + background-color: #00acdc; +} + +// product card +main { + @include roboto400; + + padding: 50px 40px; +} + +.catalog { + justify-content: center; + display: grid; + grid-template-columns: repeat(1, 200px); + gap: 48px 46px; +} + +@media (min-width: 488px) { + .catalog { + grid-template-columns: repeat(2, 1fr); + } +} + +@media (min-width: 768px) { + .catalog { + grid-template-columns: repeat(3, 1fr); + } +} + +@media (min-width: 1024px) { + .catalog { + grid-template-columns: repeat(4, 1fr); + } }