From 4de766df970770988e990f8e3ffac775a3fa8834 Mon Sep 17 00:00:00 2001 From: Ruslan95fs Date: Sat, 23 May 2026 10:31:14 +0300 Subject: [PATCH] add task solution --- .github/workflows/test.yml-template | 29 ++ package-lock.json | 9 +- package.json | 2 +- src/index.html | 413 +++++++++++++++++++++++++++- src/styles/blocks/card.scss | 135 +++++++++ src/styles/blocks/catalog.scss | 26 ++ src/styles/blocks/header.scss | 62 +++++ src/styles/blocks/stars.scss | 20 ++ src/styles/index.scss | 19 ++ src/styles/variables.scss | 11 + 10 files changed, 720 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/test.yml-template create mode 100644 src/styles/blocks/card.scss create mode 100644 src/styles/blocks/catalog.scss create mode 100644 src/styles/blocks/header.scss create mode 100644 src/styles/blocks/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/src/index.html b/src/index.html index 9cff78eeb7..a68f996fb7 100644 --- a/src/index.html +++ b/src/index.html @@ -1,3 +1,4 @@ + @@ -20,8 +21,418 @@ href="styles/index.scss" /> + -

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/blocks/card.scss b/src/styles/blocks/card.scss new file mode 100644 index 0000000000..48c6ad633d --- /dev/null +++ b/src/styles/blocks/card.scss @@ -0,0 +1,135 @@ +.card { + box-sizing: border-box; + width: $width-card; + padding: 32px 16px 16px; + border: solid 1px $border-color-card; + border-radius: $radius-card; + transition: transform 300ms; + + background-color: $main-accent-color; + + &:hover { + transform: scale(1.2); + } + + &__image-wrapper { + width: 100%; + } + + &__image { + background-image: url(../images/imac.jpeg); + width: 160px; + height: 134px; + margin: 0 auto 40px; + background-size: 160px 134px; + } + + &__content { + margin: 40px 0 0; + width: 166px; + } + + &__title { + display: block; + position: relative; + width: 166px; + font-weight: 500; + font-size: 12px; + line-height: 18px; + letter-spacing: 0%; + text-decoration: none; + color: $main-color-text; + margin-bottom: 4px; + transition: color 300ms; + } + + &:hover &__title { + color: #34568b; + } + + &__code { + width: 98px; + height: 14px; + font-weight: 400; + font-size: 10px; + line-height: 14px; + letter-spacing: 0%; + color: $secondary-color-text; + margin: 0 0 16px; + } + + &__rating { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 24px; + } + + &__reviews { + display: flex; + align-items: center; + justify-content: center; + width: 53px; + height: 16px; + + font-weight: 400; + font-size: 10px; + line-height: 14px; + letter-spacing: 0%; + color: $main-color-text; + } + + &__price { + display: flex; + justify-content: space-between; + margin-bottom: 16px; + } + + &__price-label { + font-weight: 400; + font-size: 12px; + line-height: 18px; + letter-spacing: 0%; + color: $secondary-color-text; + } + + &__price-value { + font-weight: 700; + font-size: 16px; + line-height: 18px; + letter-spacing: 0%; + color: $main-color-text; + } + + &__buy { + display: flex; + width: $width-button; + height: $height-button; + background-color: #00acdc; + border: 1px solid #00acdc; + border-radius: $radius-button; + + align-items: center; + justify-content: center; + + text-decoration: none; + font-weight: 700; + font-size: 14px; + line-height: 16px; + letter-spacing: 0%; + color: #fff; + text-transform: uppercase; + transition: + background-color 300ms, + color 300ms, + border-color 300ms; + } + + &__buy:hover { + background-color: #fff; + + color: #00acdc; + + border: 1px solid $border-color-buy; + } +} diff --git a/src/styles/blocks/catalog.scss b/src/styles/blocks/catalog.scss new file mode 100644 index 0000000000..c641b7d1a5 --- /dev/null +++ b/src/styles/blocks/catalog.scss @@ -0,0 +1,26 @@ +.catalog { + display: grid; + justify-content: center; + + grid-template-columns: repeat(1, 200px); + gap: 46px 48px; + padding: 50px 40px; +} + +@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/blocks/header.scss b/src/styles/blocks/header.scss new file mode 100644 index 0000000000..4014ef8c5c --- /dev/null +++ b/src/styles/blocks/header.scss @@ -0,0 +1,62 @@ +.header { + display: flex; + justify-content: space-between; + width: 100%; + margin: 0; + padding-inline: 50px; + box-sizing: border-box; + align-items: center; + background-color: #fff; +} + +.logo__img { + display: flex; + width: 40px; + height: 40px; +} + +.nav__list { + display: flex; + margin: 0; + padding: 0; + list-style: none; +} + +.nav__link { + display: block; + line-height: 60px; + margin-left: 20px; + text-decoration: none; + text-align: center; + position: relative; + color: #060b35; + text-transform: uppercase; + transition: color 300ms; + + &.is-active { + margin-left: 0; + + --active-color: #00acdc; + + color: #00acdc; + } + + &.is-active::after { + content: ''; + position: absolute; + left: 0; + bottom: 0; + width: 100%; + height: 4px; + background-color: var(--active-color); + border-radius: 8px; + } + + &:hover { + color: #00acdc; + } +} + +a:hover { + color: var(--active-color); +} diff --git a/src/styles/blocks/stars.scss b/src/styles/blocks/stars.scss new file mode 100644 index 0000000000..0d1ae794e2 --- /dev/null +++ b/src/styles/blocks/stars.scss @@ -0,0 +1,20 @@ +.stars { + display: flex; + + &__star { + background-image: url(../images/star.svg); + width: $star-size; + height: $star-size; + margin-right: 4px; + background-repeat: no-repeat; + background-position: center; + } + + .stars--1 &__star:nth-child(-n + 1), + .stars--2 &__star:nth-child(-n + 2), + .stars--3 &__star:nth-child(-n + 3), + .stars--4 &__star:nth-child(-n + 4), + .stars--5 &__star:nth-child(-n + 5) { + background-image: url(../images/star-active.svg); + } +} diff --git a/src/styles/index.scss b/src/styles/index.scss index 293d3b1f13..b53faf9d6b 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1,3 +1,22 @@ +@import './variables'; +@import './blocks/card'; +@import './blocks/stars'; +@import './blocks/catalog'; +@import './blocks/header'; + +* { + box-sizing: border-box; +} + +html { + font-family: Roboto, sans-serif; +} + body { margin: 0; + font-family: Roboto, sans-serif; + font-weight: 500; + font-size: 12px; + line-height: 100%; + letter-spacing: 0%; } diff --git a/src/styles/variables.scss b/src/styles/variables.scss new file mode 100644 index 0000000000..716dc32f05 --- /dev/null +++ b/src/styles/variables.scss @@ -0,0 +1,11 @@ +$width-card: 200px; +$radius-card: 5px; +$width-button: 166px; +$height-button: 40px; +$radius-button: 5px; +$star-size: 16px; +$main-accent-color: #fff; +$main-color-text: #060b35; +$secondary-color-text: #616070; +$border-color-card: #f3f3f3; +$border-color-buy: #00acdc;