From 82851523296f16d42df264bb5055fce2a1268f0f Mon Sep 17 00:00:00 2001 From: admin Date: Wed, 27 May 2026 13:20:41 +0300 Subject: [PATCH] add task solution --- .github/workflows/test.yml-template | 29 +++ package-lock.json | 9 +- package.json | 2 +- readme.md | 6 +- src/index.html | 389 +++++++++++++++++++++++++++- src/styles/card.scss | 101 ++++++++ src/styles/index.scss | 117 +++++++++ src/styles/stars.scss | 24 ++ src/styles/variables.scss | 5 + 9 files changed, 673 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/test.yml-template create mode 100644 src/styles/card.scss create mode 100644 src/styles/stars.scss create mode 100644 src/styles/variables.scss 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/readme.md b/readme.md index acd5174814..e5d6758734 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://znaumova.github.io/layout_catalog/) +- [TEST REPORT LINK](https://znaumova.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..2fc7464d02 100644 --- a/src/index.html +++ b/src/index.html @@ -22,6 +22,393 @@ -

Catalog

+
+ + + +
+ +
+
+
+ +

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

+ +

Product code: 195434

+ +
+
+
+
+
+
+
+
+ + Reviews: 5 +
+ +
+ Price: + $2,199 +
+ + + Buy + +
+
+
+ +

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

+ +

Product code: 195434

+ +
+
+
+
+
+
+
+
+ + Reviews: 5 +
+ +
+ Price: + $2,199 +
+ + + Buy + +
+
+
+ +

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

+ +

Product code: 195434

+ +
+
+
+
+
+
+
+
+ + Reviews: 5 +
+ +
+ Price: + $2,199 +
+ + + Buy + +
+
+
+ +

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

+ +

Product code: 195434

+ +
+
+
+
+
+
+
+
+ + Reviews: 5 +
+ +
+ Price: + $2,199 +
+ + + Buy + +
+
+
+ +

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

+ +

Product code: 195434

+ +
+
+
+
+
+
+
+
+ + Reviews: 5 +
+ +
+ Price: + $2,199 +
+ + + Buy + +
+
+
+ +

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

+ +

Product code: 195434

+ +
+
+
+
+
+
+
+
+ + Reviews: 5 +
+ +
+ Price: + $2,199 +
+ + + Buy + +
+
+
+ +

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

+ +

Product code: 195434

+ +
+
+
+
+
+
+
+
+ + Reviews: 5 +
+ +
+ Price: + $2,199 +
+ + + Buy + +
+
+
+ +

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

+ +

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..542754ee92 --- /dev/null +++ b/src/styles/card.scss @@ -0,0 +1,101 @@ +.card { + box-sizing: border-box; + width: 200px; + height: 408px; + border: 1px solid $gray-elements; + border-radius: 5px; + padding: 32px 16px 16px; + background: $background; + + display: flex; + flex-direction: column; + justify-content: flex-end; + + &__image { + width: 160px; + height: 134px; + background-image: url('../images/imac.jpeg'); + background-size: contain; + background-repeat: no-repeat; + background-position: center; + margin: 0 auto 40px; + } + + &__title { + width: 100%; + font-size: 12px; + font-weight: 500; + line-height: 18px; + margin-bottom: 4px; + color: $text-main; + } + + &__code { + font-size: 10px; + line-height: 14px; + color: $text-secondary; + margin-bottom: 16px; + font-weight: 400; + } + + &__review { + display: flex; + align-items: center; + justify-content: space-between; + margin-bottom: 24px; + font-weight: 400; + } + + &__reviews { + font-size: 10px; + line-height: 14px; + vertical-align: bottom; + color: $text-main; + } + + &__price-block { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 16px; + } + + &__price-label { + font-size: 12px; + font-weight: 400; + color: $text-secondary; + } + + &__price { + font-size: 16px; + font-weight: 700; + color: $text-main; + } + + &__buy { + width: 166px; + height: 40px; + font-size: 14px; + text-transform: uppercase; + text-decoration: none; + text-align: center; + padding: 12px 0; + border-radius: 5px; + + background-color: $accent-color; + color: $background; + font-weight: 700; + + border: 1px solid transparent; + + transition: + background-color 300ms, + color 300ms; + + &:hover { + background-color: $background; + color: $accent-color; + border-color: $accent-color; + } + } +} diff --git a/src/styles/index.scss b/src/styles/index.scss index 293d3b1f13..f3e150af57 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1,3 +1,120 @@ +@import './variables'; +@import './card'; +@import './stars'; + +* { + box-sizing: border-box; + margin: 0; + padding: 0; +} + +:root { + --blue: #00acdc; +} + body { margin: 0; + font-family: Roboto, sans-serif; + background-color: #fff; + font-weight: 500; + font-size: 12px; + line-height: 100%; + transition: all 300ms; +} + +.header { + display: flex; + justify-content: space-between; + align-items: center; + padding: 0 50px; + height: 60px; + text-transform: uppercase; +} + +.logo { + &__img { + display: block; + width: 40px; + height: 40px; + } +} + +.nav { + &__list { + display: flex; + margin: 0; + padding: 0; + list-style: none; + } + + &__item { + &:not(:last-child) { + margin-right: 20px; + } + } + + &__link { + position: relative; + display: flex; + justify-content: center; + align-items: center; + height: 60px; + padding: 0; + color: $text-main; + text-decoration: none; + + &:hover { + color: var(--blue); + } + + &.is-active { + color: var(--blue); + + &::after { + content: ''; + position: absolute; + right: 0; + bottom: 0; + left: 0; + height: 4px; + border-radius: 4px; + background-color: var(--blue); + } + } + } +} + +.catalog { + display: grid; + justify-content: center; + grid-template-columns: repeat(1, 200px); + gap: 46px 48px; + padding: 50px 40px; + + @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); + } +} + +.card { + transition: transform 300ms; + + &:hover { + transform: scale(1.2); + z-index: 1; + background-color: #fff; + color: #00acdc; + } + + &:hover &__title { + color: #34568b; + } } diff --git a/src/styles/stars.scss b/src/styles/stars.scss new file mode 100644 index 0000000000..1cab074151 --- /dev/null +++ b/src/styles/stars.scss @@ -0,0 +1,24 @@ +.stars { + display: flex; + + &__star { + width: 16px; + height: 16px; + + background-image: url('../images/star-active.svg'); + background-size: 13px 13px; + background-position: center; + background-repeat: no-repeat; + + &:not(:last-child) { + margin-right: 4px; + } + } + + &--1 .stars__star:nth-child(n + 2), + &--2 .stars__star:nth-child(n + 3), + &--3 .stars__star:nth-child(n + 4), + &--4 .stars__star:nth-child(n + 5) { + background-image: url('../images/star.svg'); + } +} diff --git a/src/styles/variables.scss b/src/styles/variables.scss new file mode 100644 index 0000000000..5681c80513 --- /dev/null +++ b/src/styles/variables.scss @@ -0,0 +1,5 @@ +$text-main: #060b35; +$text-secondary: #616070; +$background: #fff; +$accent-color: #00acdc; +$gray-elements: #f3f3f3;