From 3145812e08cacb79dd3d6ae7d0a90301c454c726 Mon Sep 17 00:00:00 2001 From: yulianaqq Date: Sun, 31 May 2026 13:55:32 +0300 Subject: [PATCH 1/4] add task solution --- readme.md | 6 +- src/index.html | 414 +++++++++++++++++++++++++++++++++++++- src/styles/card.scss | 124 ++++++++++++ src/styles/header.scss | 62 ++++++ src/styles/index.scss | 8 +- src/styles/page.scss | 31 +++ src/styles/stars.scss | 22 ++ src/styles/variables.scss | 8 + 8 files changed, 667 insertions(+), 8 deletions(-) create mode 100644 src/styles/card.scss create mode 100644 src/styles/header.scss create mode 100644 src/styles/page.scss create mode 100644 src/styles/stars.scss create mode 100644 src/styles/variables.scss diff --git a/readme.md b/readme.md index acd5174814..52915e2597 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,8 +33,8 @@ 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://.github.io/layout_catalog/) +- [TEST REPORT LINK](https://.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. diff --git a/src/index.html b/src/index.html index 9cff78eeb7..9ce298bf3e 100644 --- a/src/index.html +++ b/src/index.html @@ -20,8 +20,418 @@ href="styles/index.scss" /> - -

Catalog

+
+ + + + +
+ +
+
+
+
+ iMac +
+ +
Product code: 195434
+
+
+
+
+
+
+
+
+
Reviews: 5
+
+
+
Price:
+
$2,199
+
+ + Buy + +
+
+ +
+
+
+ iMac +
+ +
Product code: 195434
+
+
+
+
+
+
+
+
+
Reviews: 5
+
+
+
Price:
+
$2,199
+
+ + Buy + +
+
+ +
+
+
+ iMac +
+ +
Product code: 195434
+
+
+
+
+
+
+
+
+
Reviews: 5
+
+
+
Price:
+
$2,199
+
+ + Buy + +
+
+ +
+
+
+ iMac +
+ +
Product code: 195434
+
+
+
+
+
+
+
+
+
Reviews: 5
+
+
+
Price:
+
$2,199
+
+ + Buy + +
+
+ +
+
+
+ iMac +
+ +
Product code: 195434
+
+
+
+
+
+
+
+
+
Reviews: 5
+
+
+
Price:
+
$2,199
+
+ + Buy + +
+
+ +
+
+
+ iMac +
+ +
Product code: 195434
+
+
+
+
+
+
+
+
+
Reviews: 5
+
+
+
Price:
+
$2,199
+
+ + Buy + +
+
+ +
+
+
+ iMac +
+ +
Product code: 195434
+
+
+
+
+
+
+
+
+
Reviews: 5
+
+
+
Price:
+
$2,199
+
+ + Buy + +
+
+ +
+
+
+ iMac +
+ +
Product code: 195434
+
+
+
+
+
+
+
+
+
Reviews: 5
+
+
+
Price:
+
$2,199
+
+ + Buy + +
+
+
diff --git a/src/styles/card.scss b/src/styles/card.scss new file mode 100644 index 0000000000..05224915d1 --- /dev/null +++ b/src/styles/card.scss @@ -0,0 +1,124 @@ +.card { + box-sizing: border-box; + width: 200px; + height: 408px; + border: 1px solid $border-color; + border-radius: 5px; + background-color: #fff; + + &__content { + height: 100%; + transition: transform 300ms; + } + + &__content:hover { + transform: scale(1.2); + } + + &__image { + margin: 32px 19px 40px; + } + + &__photo { + display: block; + object-fit: cover; + object-position: center; + width: 160px; + height: 134px; + } + + &__title { + font-size: 12px; + font-weight: 500; + line-height: 18px; + letter-spacing: 0; + margin: 0 16px 4px; + } + + &__link { + display: block; + text-decoration: none; + color: $color-main; + } + + &__description { + display: block; + font-size: 10px; + font-weight: 400; + line-height: 14px; + letter-spacing: 0; + color: $color-secondary; + margin: 0 16px 16px; + } + + &__info { + display: flex; + justify-content: space-between; + align-items: center; + margin: 0 16px 24px; + } + + &__reviews { + transform: translateY(1px); + font-size: 10px; + font-weight: 400; + line-height: 14px; + letter-spacing: 0; + color: $color-main; + margin-left: 17px; + } + + &__price { + display: flex; + justify-content: space-between; + margin: 0 16px 16px; + + &-label { + font-size: 12px; + font-weight: 400; + line-height: 18px; + letter-spacing: 0; + color: $color-secondary; + } + + &-value { + font-size: 16px; + font-weight: 700; + line-height: 18px; + letter-spacing: 0; + color: $color-main; + } + } + + &__buy { + box-sizing: border-box; + border: 1px solid $color-accent; + display: flex; + justify-content: center; + align-items: center; + + width: 166px; + height: 40px; + border-radius: 5px; + background-color: $color-accent; + margin: 0 16px 16px; + + color: $color-main-button; + font-size: 14px; + font-weight: 700; + line-height: 16px; + letter-spacing: 0; + text-decoration: none; + text-transform: uppercase; + + &:hover { + background-color: $background-color-hover; + border-color: $color-accent; + color: $color-accent; + } + } +} + +.card:hover .card__link { + color: $color-link-card-hover; +} diff --git a/src/styles/header.scss b/src/styles/header.scss new file mode 100644 index 0000000000..75a8036c2a --- /dev/null +++ b/src/styles/header.scss @@ -0,0 +1,62 @@ +.header { + box-sizing: border-box; + width: 100%; + display: flex; + align-items: center; + justify-content: space-between; + padding: 0 50px; +} + +.logo { + display: block; + width: 40px; + height: 40px; +} + +.nav { + &__list { + display: flex; + list-style: none; + margin: 0; + padding: 0; + } + + &__link { + display: block; + line-height: 60px; + text-transform: uppercase; + text-decoration: none; + font-weight: 500; + font-size: 12px; + color: $color-main; + } + + &__link:hover { + color: $moyo-blue; + } + + &__item { + margin-right: 20px; + } + + &__item:last-child { + margin-right: 0; + } + + &__link.is-active { + position: relative; + color: $moyo-blue; + } + + .is-active::after { + content: ''; + position: absolute; + display: block; + background-color: $moyo-blue; + left: 0; + bottom: 0; + width: 100%; + height: 4px; + border-radius: 8px; + } +} diff --git a/src/styles/index.scss b/src/styles/index.scss index 293d3b1f13..e48e799e33 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1,3 +1,5 @@ -body { - margin: 0; -} +@import './variables'; +@import './header'; +@import './page'; +@import './stars'; +@import './card'; diff --git a/src/styles/page.scss b/src/styles/page.scss new file mode 100644 index 0000000000..21705736b0 --- /dev/null +++ b/src/styles/page.scss @@ -0,0 +1,31 @@ +body { + margin: 0; + padding: 0; + font-family: Roboto, Arial, sans-serif; +} + +.catalog { + display: grid; + padding: 50px 40px; + grid-template-columns: repeat(1, 200px); + gap: 46px 48px; + justify-content: center; +} + +@media (min-width: 488px) { + .catalog { + grid-template-columns: repeat(2, 200px); + } +} + +@media (min-width: 768px) { + .catalog { + grid-template-columns: repeat(3, 200px); + } +} + +@media (min-width: 1024px) { + .catalog { + grid-template-columns: repeat(4, 200px); + } +} diff --git a/src/styles/stars.scss b/src/styles/stars.scss new file mode 100644 index 0000000000..7fb4fa20da --- /dev/null +++ b/src/styles/stars.scss @@ -0,0 +1,22 @@ +.stars { + display: flex; + + &__star { + width: 16px; + height: 16px; + background-image: url(../images/star.svg); + background-repeat: no-repeat; + margin-right: 4px; + background-position: center; + } + + &__star:last-child { + margin-right: 0; + } + + @for $i from 1 through 5 { + &--#{$i} &__star:nth-child(-n + #{$i}) { + 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..443c612c4a --- /dev/null +++ b/src/styles/variables.scss @@ -0,0 +1,8 @@ +$moyo-blue: #00acdc; +$color-main: #060b35; +$color-secondary: #616070; +$color-accent: #00acdc; +$color-main-button: #fff; +$border-color: #f3f3f3; +$background-color-hover: #f3f3f3; +$color-link-card-hover: #34568b; From e4a3b0dc8f4aeda675032d5e41cf94925cb13769 Mon Sep 17 00:00:00 2001 From: yulianaqq Date: Sun, 31 May 2026 14:12:06 +0300 Subject: [PATCH 2/4] add task solution --- src/index.html | 2 +- src/styles/card.scss | 24 +++++------------------- src/styles/header.scss | 2 +- src/styles/variables.scss | 2 +- 4 files changed, 8 insertions(+), 22 deletions(-) diff --git a/src/index.html b/src/index.html index 9ce298bf3e..9985ac4b20 100644 --- a/src/index.html +++ b/src/index.html @@ -24,7 +24,7 @@
diff --git a/src/styles/card.scss b/src/styles/card.scss index 05224915d1..65c39c82b2 100644 --- a/src/styles/card.scss +++ b/src/styles/card.scss @@ -5,16 +5,13 @@ border: 1px solid $border-color; border-radius: 5px; background-color: #fff; + overflow: hidden; &__content { height: 100%; transition: transform 300ms; } - &__content:hover { - transform: scale(1.2); - } - &__image { margin: 32px 19px 40px; } @@ -31,7 +28,6 @@ font-size: 12px; font-weight: 500; line-height: 18px; - letter-spacing: 0; margin: 0 16px 4px; } @@ -46,7 +42,6 @@ font-size: 10px; font-weight: 400; line-height: 14px; - letter-spacing: 0; color: $color-secondary; margin: 0 16px 16px; } @@ -62,8 +57,6 @@ transform: translateY(1px); font-size: 10px; font-weight: 400; - line-height: 14px; - letter-spacing: 0; color: $color-main; margin-left: 17px; } @@ -75,17 +68,12 @@ &-label { font-size: 12px; - font-weight: 400; - line-height: 18px; - letter-spacing: 0; color: $color-secondary; } &-value { font-size: 16px; font-weight: 700; - line-height: 18px; - letter-spacing: 0; color: $color-main; } } @@ -106,19 +94,17 @@ color: $color-main-button; font-size: 14px; font-weight: 700; - line-height: 16px; - letter-spacing: 0; text-decoration: none; text-transform: uppercase; &:hover { - background-color: $background-color-hover; + background-color: #fff; // FIXED border-color: $color-accent; color: $color-accent; } } -} -.card:hover .card__link { - color: $color-link-card-hover; + &:hover .card__content { + transform: scale(1.2); + } } diff --git a/src/styles/header.scss b/src/styles/header.scss index 75a8036c2a..fa4fd8ac01 100644 --- a/src/styles/header.scss +++ b/src/styles/header.scss @@ -7,7 +7,7 @@ padding: 0 50px; } -.logo { +.header__logo { display: block; width: 40px; height: 40px; diff --git a/src/styles/variables.scss b/src/styles/variables.scss index 443c612c4a..3e1a98880f 100644 --- a/src/styles/variables.scss +++ b/src/styles/variables.scss @@ -4,5 +4,5 @@ $color-secondary: #616070; $color-accent: #00acdc; $color-main-button: #fff; $border-color: #f3f3f3; -$background-color-hover: #f3f3f3; +$background-color-hover: #fff; $color-link-card-hover: #34568b; From 7daffe2ee5c0863c40fcbe5173e2dd03d3e491eb Mon Sep 17 00:00:00 2001 From: yulianaqq Date: Sun, 31 May 2026 19:30:34 +0300 Subject: [PATCH 3/4] fix card title hover --- .github/workflows/test.yml-template | 29 +++++++++++++++++++++++++++++ package-lock.json | 9 +++++---- package.json | 2 +- src/styles/card.scss | 4 ++++ 4 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/test.yml-template diff --git a/.github/workflows/test.yml-template b/.github/workflows/test.yml-template new file mode 100644 index 0000000000..8b5743ecb4 --- /dev/null +++ b/.github/workflows/test.yml-template @@ -0,0 +1,29 @@ +name: Test + +on: + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [20.x] + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm install + - run: npm test + - name: Upload HTML report(backstop data) + if: ${{ always() }} + uses: actions/upload-artifact@v2 + with: + name: report + path: backstop_data diff --git a/package-lock.json b/package-lock.json index 6dd164c6e0..664cd93eb5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,7 @@ "@mate-academy/backstop-config": "latest", "@mate-academy/bemlint": "latest", "@mate-academy/linthtml-config": "latest", - "@mate-academy/scripts": "^1.8.6", + "@mate-academy/scripts": "^2.1.3", "@mate-academy/stylelint-config": "latest", "@parcel/transformer-sass": "^2.12.0", "backstopjs": "6.3.23", @@ -1212,10 +1212,11 @@ "dev": true }, "node_modules/@mate-academy/scripts": { - "version": "1.8.6", - "resolved": "https://registry.npmjs.org/@mate-academy/scripts/-/scripts-1.8.6.tgz", - "integrity": "sha512-b4om/whj4G9emyi84ORE3FRZzCRwRIesr8tJHXa8EvJdOaAPDpzcJ8A0sFfMsWH9NUOVmOwkBtOXDu5eZZ00Ig==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@mate-academy/scripts/-/scripts-2.1.3.tgz", + "integrity": "sha512-a07wHTj/1QUK2Aac5zHad+sGw4rIvcNl5lJmJpAD7OxeSbnCdyI6RXUHwXhjF5MaVo9YHrJ0xVahyERS2IIyBQ==", "dev": true, + "license": "MIT", "dependencies": { "@octokit/rest": "^17.11.2", "@types/get-port": "^4.2.0", diff --git a/package.json b/package.json index 34398805fa..f538e623d5 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "@mate-academy/backstop-config": "latest", "@mate-academy/bemlint": "latest", "@mate-academy/linthtml-config": "latest", - "@mate-academy/scripts": "^1.8.6", + "@mate-academy/scripts": "^2.1.3", "@mate-academy/stylelint-config": "latest", "@parcel/transformer-sass": "^2.12.0", "backstopjs": "6.3.23", diff --git a/src/styles/card.scss b/src/styles/card.scss index 65c39c82b2..159b99391a 100644 --- a/src/styles/card.scss +++ b/src/styles/card.scss @@ -108,3 +108,7 @@ transform: scale(1.2); } } + +.card:hover .card__title { + color: $color-link-card-hover; +} From fa2cee8c51a62678db43bd8279e07454e01f5bfc Mon Sep 17 00:00:00 2001 From: yulianaqq Date: Sun, 31 May 2026 19:37:58 +0300 Subject: [PATCH 4/4] fix card hover color --- src/styles/card.scss | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/styles/card.scss b/src/styles/card.scss index 159b99391a..05224915d1 100644 --- a/src/styles/card.scss +++ b/src/styles/card.scss @@ -5,13 +5,16 @@ border: 1px solid $border-color; border-radius: 5px; background-color: #fff; - overflow: hidden; &__content { height: 100%; transition: transform 300ms; } + &__content:hover { + transform: scale(1.2); + } + &__image { margin: 32px 19px 40px; } @@ -28,6 +31,7 @@ font-size: 12px; font-weight: 500; line-height: 18px; + letter-spacing: 0; margin: 0 16px 4px; } @@ -42,6 +46,7 @@ font-size: 10px; font-weight: 400; line-height: 14px; + letter-spacing: 0; color: $color-secondary; margin: 0 16px 16px; } @@ -57,6 +62,8 @@ transform: translateY(1px); font-size: 10px; font-weight: 400; + line-height: 14px; + letter-spacing: 0; color: $color-main; margin-left: 17px; } @@ -68,12 +75,17 @@ &-label { font-size: 12px; + font-weight: 400; + line-height: 18px; + letter-spacing: 0; color: $color-secondary; } &-value { font-size: 16px; font-weight: 700; + line-height: 18px; + letter-spacing: 0; color: $color-main; } } @@ -94,21 +106,19 @@ color: $color-main-button; font-size: 14px; font-weight: 700; + line-height: 16px; + letter-spacing: 0; text-decoration: none; text-transform: uppercase; &:hover { - background-color: #fff; // FIXED + background-color: $background-color-hover; border-color: $color-accent; color: $color-accent; } } - - &:hover .card__content { - transform: scale(1.2); - } } -.card:hover .card__title { +.card:hover .card__link { color: $color-link-card-hover; }