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..cd8093834a 100644 --- a/src/index.html +++ b/src/index.html @@ -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..b4accb61d5 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1,3 +1,25 @@ +@use 'utils/variables' as v; +@import 'utils/stars-block'; +@import 'utils/bem-block'; + +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; } diff --git a/src/styles/utils/bem-block.scss b/src/styles/utils/bem-block.scss new file mode 100644 index 0000000000..66476d16c1 --- /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; + } + &__review { + 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; + } +} + +.reviews { + 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; + + &__title { + 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;