From f6c109d24aa2dd30c589ed8755acf44f13b2b408 Mon Sep 17 00:00:00 2001 From: "artur.manuilenko" Date: Mon, 23 Dec 2024 20:12:35 +0200 Subject: [PATCH] Update product card layout and styles; upgrade @mate-academy/scripts version --- .github/workflows/test.yml-template | 29 ++++++++++ package-lock.json | 9 +-- package.json | 2 +- readme.md | 4 +- src/index.html | 53 +++++++++++++++++- src/styles/card.scss | 85 +++++++++++++++++++++++++++++ src/styles/index.scss | 7 ++- src/styles/stars.scss | 18 ++++++ src/styles/variables.scss | 3 + 9 files changed, 201 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 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..7b300f59f8 100644 --- a/readme.md +++ b/readme.md @@ -23,8 +23,8 @@ This is possible because [we use the Parcel library](https://en.parceljs.org/scs ❗️ 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://Manuilenkoart.github.io/layout_product-cards/) +- [TEST REPORT LINK](https://Manuilenkoart.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..63cddaf9c5 100644 --- a/src/index.html +++ b/src/index.html @@ -7,12 +7,63 @@ content="width=device-width, initial-scale=1.0" /> Product cards + + + -

Product cards

+
+ desktop +

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

+ +

Product code: 195434

+ +
+
+ + + + + +
+ +

Reviews: 5

+
+ +
+

Price:

+

$2,199

+
+ + +
diff --git a/src/styles/card.scss b/src/styles/card.scss new file mode 100644 index 0000000000..2e1554c9c5 --- /dev/null +++ b/src/styles/card.scss @@ -0,0 +1,85 @@ +@import './variables'; + +.card { + box-sizing: border-box; + border: 1px solid #f3f3f3; + width: 200px; + padding: 32px 16px 16px; + font-family: Roboto, sans-serif; + + &__image { + width: 160px; + height: 134px; + display: block; + margin: auto auto 40px; + } + + &__title { + color: $color-main; + margin-bottom: 4px; + font-size: 12px; + font-weight: 500; + line-height: 18px; + } + + &__code { + font-size: 10px; + font-weight: 400; + line-height: 14px; + color: $color-secondary; + margin-bottom: 16px; + } + + &__review { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 24px; + } + + &__count { + font-size: 10px; + font-weight: 400; + line-height: 14px; + color: $color-main; + } + + &__price { + display: flex; + justify-content: space-between; + margin-bottom: 16px; + } + + &__description { + font-size: 12px; + font-weight: 400; + line-height: 18px; + color: $color-secondary; + } + + &__value { + font-size: 16px; + font-weight: 700; + line-height: 18px; + color: $color-main; + } + + &__button { + width: 100%; + text-transform: uppercase; + background-color: $blue-accent; + color: #fff; + border-radius: 5px; + padding: 12px 0; + border: 1px solid $blue-accent; + font-size: 14px; + font-weight: 700; + + &:hover { + color: $blue-accent; + background-color: #fff; + + cursor: pointer; + } + } +} diff --git a/src/styles/index.scss b/src/styles/index.scss index 293d3b1f13..c24dcf08c3 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1,3 +1,8 @@ -body { +@import './stars'; +@import './card'; + +body, +h2, +p { margin: 0; } diff --git a/src/styles/stars.scss b/src/styles/stars.scss new file mode 100644 index 0000000000..b0a84f20d5 --- /dev/null +++ b/src/styles/stars.scss @@ -0,0 +1,18 @@ +.stars { + display: flex; + + &__star { + background-image: url('../images/star.svg'); + background-repeat: no-repeat; + background-position: 50%; + margin-right: 4px; + width: 16px; + height: 16px; + } + + @for $activeStar from 1 through 4 { + &__star:nth-child(-n + #{$activeStar}) { + 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..405672d67c --- /dev/null +++ b/src/styles/variables.scss @@ -0,0 +1,3 @@ +$color-main: #060b35; +$color-secondary: #616070; +$blue-accent: #00acdc;