From 19dbbc66c8fa6a60561bdd29fe7a9db22cf265c8 Mon Sep 17 00:00:00 2001 From: Gennadiy99 Date: Mon, 16 Dec 2024 21:12:16 +0100 Subject: [PATCH 1/4] first commit --- .github/workflows/test.yml-template | 29 +++++++++++++++++++++++++++++ package-lock.json | 9 +++++---- package.json | 2 +- readme.md | 8 ++++---- src/index.html | 2 +- 5 files changed, 40 insertions(+), 10 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 373f5d0040..1890861f0c 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": "^1.9.12", "@mate-academy/stylelint-config": "latest", "@parcel/transformer-sass": "^2.12.0", "backstopjs": "6.3.23", @@ -1230,10 +1230,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": "1.9.12", + "resolved": "https://registry.npmjs.org/@mate-academy/scripts/-/scripts-1.9.12.tgz", + "integrity": "sha512-/OcmxMa34lYLFlGx7Ig926W1U1qjrnXbjFJ2TzUcDaLmED+A5se652NcWwGOidXRuMAOYLPU2jNYBEkKyXrFJA==", "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 4b42d42f7b..cc5756264b 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": "^1.9.12", "@mate-academy/stylelint-config": "latest", "@parcel/transformer-sass": "^2.12.0", "backstopjs": "6.3.23", diff --git a/readme.md b/readme.md index b1f43ed970..704e2a14b1 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,6 @@ # Product cards -Create a page with product card using `flexbox`, `BEM` and `SCSS` based on [this mockup](https://www.figma.com/file/ojkArVazq7vsX0nbpn9CxZ/Moyo-%2F-Catalog-(ENG)?node-id=11325%3A2287&mode=dev). +Create a page with product card using `flexbox`, `BEM` and `SCSS` based on [this mockup](). > Here are the [Layout Tasks Instructions](https://mate-academy.github.io/layout_task-guideline) @@ -16,15 +16,15 @@ Create a page with product card using `flexbox`, `BEM` and `SCSS` based on [this - Rewrite the `stars` block from the [Stars task](https://github.com/mate-academy/layout_stars) with SCSS and use it - Find the required font on [google fonts](https://fonts.google.com/) and use. -*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_product-cards/) -- [TEST REPORT LINK](https://.github.io/layout_product-cards/report/html_report/) +- [DEMO LINK](https://Gennadiy99.github.io/layout_product-cards/) +- [TEST REPORT LINK](https://Gennadiy99.github.io/layout_product-cards/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 43745cc17f..7570fe3a49 100644 --- a/src/index.html +++ b/src/index.html @@ -1,4 +1,4 @@ - + From 0a152ce8b9fb6f9cdbfefab9216c122cf5898b2c Mon Sep 17 00:00:00 2001 From: Gennadiy99 Date: Tue, 17 Dec 2024 21:50:54 +0100 Subject: [PATCH 2/4] finished the project --- src/index.html | 53 +++++++++++++++- src/styles/index.scss | 144 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 195 insertions(+), 2 deletions(-) diff --git a/src/index.html b/src/index.html index 7570fe3a49..da72a02662 100644 --- a/src/index.html +++ b/src/index.html @@ -1,4 +1,4 @@ - + @@ -7,12 +7,61 @@ content="width=device-width, initial-scale=1.0" /> Product cards + + + -

Product cards

+
+ picture product +
+

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

+

Product code: 195434

+
+
+
+
+
+
+
+
+
+
Reviews: 5
+
+
+

Price:

+
$2,199
+
+ + Buy + +
diff --git a/src/styles/index.scss b/src/styles/index.scss index 293d3b1f13..52afd315f1 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1,3 +1,147 @@ +html { + box-sizing: border-box; +} + +*, +*::after, +*::before { + box-sizing: inherit; +} + +h3, +p { + margin: 0; +} + body { margin: 0; + font-family: Roboto, sans-serif; + font-weight: 400; + font-style: normal; +} + +.card { + max-width: 200px; + width: 100%; + padding: 32px 16px 16px; + border-radius: 5px; + + &__img { + width: 100%; + margin-bottom: 40px; + } + &__prod { + margin-bottom: 16px; + } + &__rewie { + margin-bottom: 24px; + } + &__price { + margin-bottom: 16px; + } +} + +.product { + &__title { + font-weight: 500; + font-size: 12px; + line-height: 150%; + color: #060b35; + margin-bottom: 4px; + } + &__code { + font-weight: 400; + font-size: 10px; + line-height: 140%; + color: #616070; + } +} + +.rewiews { + display: flex; + justify-content: space-between; + height: 16px; + min-width: 116px; + width: 100%; + gap: 17px; + + &__stars { + flex-grow: 1; + } + + &__count { + font-weight: 400; + font-size: 10px; + line-height: 140%; + text-align: right; + color: #060b35; + } +} + +.stars { + display: flex; + + &__star { + width: 16px; + height: 16px; + background-image: url(../images/star.svg); + background-repeat: no-repeat; + background-position: center; + margin-right: 4px; + } + + &__star:last-child { + margin-right: 0; + } + + &--1 &__star:nth-child(1), + &--2 &__star:nth-child(-n + 2), + &--3 &__star:nth-child(-n + 3), + &--4 &__star:nth-child(-n + 4), + &--5 &__star:nth-child(-n + 5) { + background-image: url(../images/star-active.svg); + } +} + +.price { + display: flex; + justify-content: space-between; + + &__titel { + font-weight: 400; + font-size: 12px; + line-height: 150%; + color: #616070; + } + + &__current { + font-weight: 700; + font-size: 16px; + line-height: 112%; + text-align: right; + color: #060b35; + } +} + +.btn-link { + display: block; + border-radius: 5px; + width: 166px; + height: 40px; + background-color: #00acdc; + + text-decoration: none; + color: #fff; + text-transform: uppercase; + text-align: center; + font-weight: 700; + font-size: 14px; + line-height: 40px; + transition: all 0.3s; + + &--hover:hover { + background-color: #fff; + color: #00acdc; + border: solid 1px #00acdc; + } } From c92c3b6b5ce65f3f792d98d793f3d264d4b689a1 Mon Sep 17 00:00:00 2001 From: Gennadiy99 Date: Wed, 18 Dec 2024 20:04:15 +0100 Subject: [PATCH 3/4] add @import @use utils --- src/styles/index.scss | 130 +----------------------------- src/styles/utils/bem-block.scss | 100 +++++++++++++++++++++++ src/styles/utils/stars-block.scss | 24 ++++++ src/styles/utils/variables.scss | 2 + 4 files changed, 130 insertions(+), 126 deletions(-) create mode 100644 src/styles/utils/bem-block.scss create mode 100644 src/styles/utils/stars-block.scss create mode 100644 src/styles/utils/variables.scss diff --git a/src/styles/index.scss b/src/styles/index.scss index 52afd315f1..b4accb61d5 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1,3 +1,7 @@ +@use 'utils/variables' as v; +@import 'utils/stars-block'; +@import 'utils/bem-block'; + html { box-sizing: border-box; } @@ -19,129 +23,3 @@ body { font-weight: 400; font-style: normal; } - -.card { - max-width: 200px; - width: 100%; - padding: 32px 16px 16px; - border-radius: 5px; - - &__img { - width: 100%; - margin-bottom: 40px; - } - &__prod { - margin-bottom: 16px; - } - &__rewie { - margin-bottom: 24px; - } - &__price { - margin-bottom: 16px; - } -} - -.product { - &__title { - font-weight: 500; - font-size: 12px; - line-height: 150%; - color: #060b35; - margin-bottom: 4px; - } - &__code { - font-weight: 400; - font-size: 10px; - line-height: 140%; - color: #616070; - } -} - -.rewiews { - display: flex; - justify-content: space-between; - height: 16px; - min-width: 116px; - width: 100%; - gap: 17px; - - &__stars { - flex-grow: 1; - } - - &__count { - font-weight: 400; - font-size: 10px; - line-height: 140%; - text-align: right; - color: #060b35; - } -} - -.stars { - display: flex; - - &__star { - width: 16px; - height: 16px; - background-image: url(../images/star.svg); - background-repeat: no-repeat; - background-position: center; - margin-right: 4px; - } - - &__star:last-child { - margin-right: 0; - } - - &--1 &__star:nth-child(1), - &--2 &__star:nth-child(-n + 2), - &--3 &__star:nth-child(-n + 3), - &--4 &__star:nth-child(-n + 4), - &--5 &__star:nth-child(-n + 5) { - background-image: url(../images/star-active.svg); - } -} - -.price { - display: flex; - justify-content: space-between; - - &__titel { - font-weight: 400; - font-size: 12px; - line-height: 150%; - color: #616070; - } - - &__current { - font-weight: 700; - font-size: 16px; - line-height: 112%; - text-align: right; - color: #060b35; - } -} - -.btn-link { - display: block; - border-radius: 5px; - width: 166px; - height: 40px; - background-color: #00acdc; - - text-decoration: none; - color: #fff; - text-transform: uppercase; - text-align: center; - font-weight: 700; - font-size: 14px; - line-height: 40px; - transition: all 0.3s; - - &--hover:hover { - background-color: #fff; - color: #00acdc; - border: solid 1px #00acdc; - } -} diff --git a/src/styles/utils/bem-block.scss b/src/styles/utils/bem-block.scss new file mode 100644 index 0000000000..76ab578acf --- /dev/null +++ b/src/styles/utils/bem-block.scss @@ -0,0 +1,100 @@ +.card { + max-width: 200px; + width: 100%; + padding: 32px 16px 16px; + border-radius: 5px; + + &__img { + width: 100%; + margin-bottom: 40px; + } + &__prod { + margin-bottom: 16px; + } + &__rewie { + margin-bottom: 24px; + } + &__price { + margin-bottom: 16px; + } +} + +.product { + &__title { + font-weight: 500; + font-size: 12px; + line-height: 150%; + color: v.$col-blue; + margin-bottom: 4px; + } + &__code { + font-weight: 400; + font-size: 10px; + line-height: 140%; + color: v.$col-grey; + } +} + +.rewiews { + display: flex; + justify-content: space-between; + height: 16px; + min-width: 116px; + width: 100%; + gap: 17px; + + &__stars { + flex-grow: 1; + } + + &__count { + font-weight: 400; + font-size: 10px; + line-height: 140%; + text-align: right; + color: v.$col-blue; + } +} + +.price { + display: flex; + justify-content: space-between; + + &__titel { + font-weight: 400; + font-size: 12px; + line-height: 150%; + color: v.$col-grey; + } + + &__current { + font-weight: 700; + font-size: 16px; + line-height: 112%; + text-align: right; + color: v.$col-blue; + } +} + +.btn-link { + display: block; + border-radius: 5px; + width: 166px; + height: 40px; + background-color: #00acdc; + + text-decoration: none; + color: #fff; + text-transform: uppercase; + text-align: center; + font-weight: 700; + font-size: 14px; + line-height: 40px; + transition: all 0.3s; + + &--hover:hover { + background-color: #fff; + color: #00acdc; + border: solid 1px #00acdc; + } +} diff --git a/src/styles/utils/stars-block.scss b/src/styles/utils/stars-block.scss new file mode 100644 index 0000000000..643eea2f8f --- /dev/null +++ b/src/styles/utils/stars-block.scss @@ -0,0 +1,24 @@ +.stars { + display: flex; + + &__star { + width: 16px; + height: 16px; + background-image: url(../images/star.svg); + background-repeat: no-repeat; + background-position: center; + margin-right: 4px; + } + + &__star:last-child { + margin-right: 0; + } + + &--1 &__star:nth-child(1), + &--2 &__star:nth-child(-n + 2), + &--3 &__star:nth-child(-n + 3), + &--4 &__star:nth-child(-n + 4), + &--5 &__star:nth-child(-n + 5) { + background-image: url(../images/star-active.svg); + } +} diff --git a/src/styles/utils/variables.scss b/src/styles/utils/variables.scss new file mode 100644 index 0000000000..b6ba0c348c --- /dev/null +++ b/src/styles/utils/variables.scss @@ -0,0 +1,2 @@ +$col-blue: #060b35; +$col-grey: #616070; From 8c81b7516995f565099e699d34fc0bd64d5d63b6 Mon Sep 17 00:00:00 2001 From: Gennadiy99 Date: Wed, 18 Dec 2024 20:26:20 +0100 Subject: [PATCH 4/4] changed title review --- src/index.html | 8 ++++---- src/styles/utils/bem-block.scss | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/index.html b/src/index.html index da72a02662..cd8093834a 100644 --- a/src/index.html +++ b/src/index.html @@ -41,18 +41,18 @@

Product code: 195434

-
-
+
+
-
Reviews: 5
+
Reviews: 5
-

Price:

+

Price:

$2,199