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..a1c3f92dc2 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", @@ -5471,87 +5472,6 @@ "node": ">=12 || >=16" } }, - "node_modules/css-select": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/css-select/-/css-select-5.1.0.tgz", - "integrity": "sha512-nwoRF1rvRRnnCqqY7updORDsuqKzqYJ28+oSMaJMMgOauh3fvwHqMS7EZpIPqK8GL+g9mKxF1vP/ZjSeNjEVHg==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "boolbase": "^1.0.0", - "css-what": "^6.1.0", - "domhandler": "^5.0.2", - "domutils": "^3.0.1", - "nth-check": "^2.0.1" - }, - "funding": { - "url": "https://github.com/sponsors/fb55" - } - }, - "node_modules/css-select/node_modules/dom-serializer": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", - "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "domelementtype": "^2.3.0", - "domhandler": "^5.0.2", - "entities": "^4.2.0" - }, - "funding": { - "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" - } - }, - "node_modules/css-select/node_modules/domhandler": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz", - "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "domelementtype": "^2.3.0" - }, - "engines": { - "node": ">= 4" - }, - "funding": { - "url": "https://github.com/fb55/domhandler?sponsor=1" - } - }, - "node_modules/css-select/node_modules/domutils": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.1.0.tgz", - "integrity": "sha512-H78uMmQtI2AhgDJjWeQmHwJJ2bLPD3GMmO7Zja/ZZh84wkm+4ut+IUnUdRa8uCGX88DiVx1j6FRe1XfxEgjEZA==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "dom-serializer": "^2.0.0", - "domelementtype": "^2.3.0", - "domhandler": "^5.0.3" - }, - "funding": { - "url": "https://github.com/fb55/domutils?sponsor=1" - } - }, - "node_modules/css-select/node_modules/entities": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", - "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", - "dev": true, - "optional": true, - "peer": true, - "engines": { - "node": ">=0.12" - }, - "funding": { - "url": "https://github.com/fb55/entities?sponsor=1" - } - }, "node_modules/css-tree": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.3.1.tgz", @@ -5589,45 +5509,6 @@ "node": ">=4" } }, - "node_modules/csso": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/csso/-/csso-5.0.5.tgz", - "integrity": "sha512-0LrrStPOdJj+SPCCrGhzryycLjwcgUSHBtxNA8aIDxf0GLsRh1cKYhB00Gd1lDOS4yGH69+SNn13+TWbVHETFQ==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "css-tree": "~2.2.0" - }, - "engines": { - "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0", - "npm": ">=7.0.0" - } - }, - "node_modules/csso/node_modules/css-tree": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.2.1.tgz", - "integrity": "sha512-OA0mILzGc1kCOCSJerOeqDxDQ4HOh+G8NbOJFOTgOCzpw7fCBubk0fEyxp8AgOL/jvLgYA/uV0cMbe43ElF1JA==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "mdn-data": "2.0.28", - "source-map-js": "^1.0.1" - }, - "engines": { - "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0", - "npm": ">=7.0.0" - } - }, - "node_modules/csso/node_modules/mdn-data": { - "version": "2.0.28", - "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.28.tgz", - "integrity": "sha512-aylIc7Z9y4yzHYAJNuESG3hfhC+0Ibp/MAMiaOZgNv4pmEdFyfZhhhny4MNiAfWdBQ1RQ2mfDWmM1x8SvGyp8g==", - "dev": true, - "optional": true, - "peer": true - }, "node_modules/data-uri-to-buffer": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-6.0.2.tgz", @@ -10757,20 +10638,6 @@ "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", "dev": true }, - "node_modules/srcset": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/srcset/-/srcset-5.0.1.tgz", - "integrity": "sha512-/P1UYbGfJVlxZag7aABNRrulEXAwCSDo7fklafOQrantuPTDmYgijJMks2zusPCVzgW9+4P69mq7w6pYuZpgxw==", - "dev": true, - "optional": true, - "peer": true, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/stable": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/stable/-/stable-0.1.8.tgz", @@ -11176,33 +11043,6 @@ "integrity": "sha512-ovssysQTa+luh7A5Weu3Rta6FJlFBBbInjOh722LIt6klpU2/HtdUbszju/G4devcvk8PGt7FCLv5wftu3THUA==", "dev": true }, - "node_modules/svgo": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/svgo/-/svgo-3.3.2.tgz", - "integrity": "sha512-OoohrmuUlBs8B8o6MB2Aevn+pRIH9zDALSR+6hhqVfa6fRwG/Qw9VUMSMW9VNg2CFc/MTIfabtdOVl9ODIJjpw==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "@trysound/sax": "0.2.0", - "commander": "^7.2.0", - "css-select": "^5.1.0", - "css-tree": "^2.3.1", - "css-what": "^6.1.0", - "csso": "^5.0.5", - "picocolors": "^1.0.0" - }, - "bin": { - "svgo": "bin/svgo" - }, - "engines": { - "node": ">=14.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/svgo" - } - }, "node_modules/table": { "version": "6.8.2", "resolved": "https://registry.npmjs.org/table/-/table-6.8.2.tgz", 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..586706dcfc 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` @@ -32,15 +32,15 @@ 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/) +❗️ Replace `enot333lol333-coder` with your GitHub username and copy the links to the `Pull Request` description: +- [DEMO LINK](https://enot333lol333-coder.github.io/layout_catalog/) +- [TEST REPORT LINK](https://enot333lol333-coder.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. -- [ ] All components follow BEM and use SCSS -- [ ] Repeated sizes and special colors are put to variables -- [ ] Grid is used for the columns -- [ ] Cards are shown in 1, 2, 3, or 4 columns based on screen resolution -- [ ] All changes on `:hover` are smooth -- [ ] Code follows all the [Code Style Rules ❗️](https://mate-academy.github.io/layout_task-guideline/html-css-code-style-rules) +- [x] All components follow BEM and use SCSS +- [x] Repeated sizes and special colors are put to variables +- [x] Grid is used for the columns +- [x] Cards are shown in 1, 2, 3, or 4 columns based on screen resolution +- [x] All changes on `:hover` are smooth +- [x] Code follows all the [Code Style Rules ❗️](https://mate-academy.github.io/layout_task-guideline/html-css-code-style-rules) diff --git a/src/index.html b/src/index.html index 9cff78eeb7..971e93c177 100644 --- a/src/index.html +++ b/src/index.html @@ -1,4 +1,4 @@ - + @@ -6,22 +6,235 @@ name="viewport" content="width=device-width, initial-scale=1.0" /> - Catalog - + Moyo Catalog + + - + - -

Catalog

+
+
+ + +
+
+
+
+
+ APPLE A1419 iMac +

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

+

Product code: 195434

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

+ Price: + $2,199 +

+ Buy +
+
+ APPLE A1419 iMac +

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

+

Product code: 195434

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

+ Price: + $2,199 +

+ Buy +
+
+ APPLE A1419 iMac +

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

+

Product code: 195434

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

+ Price: + $2,199 +

+ Buy +
+
+ APPLE A1419 iMac +

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

+

Product code: 195434

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

+ Price: + $2,199 +

+ Buy +
+
+ APPLE A1419 iMac +

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

+

Product code: 195434

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

+ Price: + $2,199 +

+ Buy +
+
+ APPLE A1419 iMac +

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

+

Product code: 195434

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

+ Price: + $2,199 +

+ Buy +
+
+ APPLE A1419 iMac +

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

+

Product code: 195434

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

+ Price: + $2,199 +

+ Buy +
+
+ APPLE A1419 iMac +

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

+

Product code: 195434

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

+ Price: + $2,199 +

+ Buy +
+
+
diff --git a/src/styles/_card.scss b/src/styles/_card.scss new file mode 100644 index 0000000000..bf3ad1e96f --- /dev/null +++ b/src/styles/_card.scss @@ -0,0 +1,92 @@ +.card { + width: $card-width; + padding: 16px; + background: $color-white; + position: relative; + transition: transform $transition; + + &__image { + width: 100%; + display: block; + } + + &__title { + font-size: 14px; + font-weight: 700; + color: $color-dark; + margin: 8px 0 4px; + transition: color $transition; + } + + &__code { + font-size: 11px; + color: $color-text-light; + margin: 0 0 8px; + } + + &__stars { + display: flex; + align-items: center; + gap: 2px; + margin-bottom: 12px; + + img { + width: 16px; + height: 16px; + } + } + + &__reviews { + font-size: 11px; + color: $color-text-light; + margin-left: 6px; + } + + &__price { + display: flex; + justify-content: space-between; + align-items: center; + margin: 0 0 12px; + font-size: 13px; + } + + &__price-label { + color: $color-text-light; + } + + &__price-value { + font-weight: 700; + font-size: 20px; + color: $color-dark; + } + + &__button { + display: block; + width: 100%; + padding: 10px 0; + background: $color-primary; + color: $color-white; + text-align: center; + text-decoration: none; + text-transform: uppercase; + font-size: 12px; + font-weight: 700; + letter-spacing: 1px; + box-sizing: border-box; + transition: background $transition, color $transition; + + &:hover { + background: $color-white; + color: $color-primary; + } + } + + &:hover { + transform: scale(1.2); + z-index: 1; + } + + &:hover &__title { + color: $color-title-hover; + } +} diff --git a/src/styles/_catalog.scss b/src/styles/_catalog.scss new file mode 100644 index 0000000000..8bae317b6b --- /dev/null +++ b/src/styles/_catalog.scss @@ -0,0 +1,23 @@ +.catalog { + padding: 50px 40px; + display: flex; + justify-content: center; + + &__grid { + display: grid; + gap: 46px 48px; + grid-template-columns: repeat(1, 200px); + + @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); + } + } +} diff --git a/src/styles/_header.scss b/src/styles/_header.scss new file mode 100644 index 0000000000..26fe8cfb9a --- /dev/null +++ b/src/styles/_header.scss @@ -0,0 +1,16 @@ +.header { + border-bottom: 1px solid $color-border; + + &__inner { + display: flex; + align-items: center; + justify-content: center; + gap: 80px; + height: 60px; + padding: 0 40px; + } +} + +.logo { + flex-shrink: 0; +} diff --git a/src/styles/_nav.scss b/src/styles/_nav.scss new file mode 100644 index 0000000000..dd95a0e6b8 --- /dev/null +++ b/src/styles/_nav.scss @@ -0,0 +1,34 @@ +.nav { + &__list { + display: flex; + align-items: center; + gap: 40px; + list-style: none; + margin: 0; + padding: 0; + height: 60px; + } + + &__link { + display: flex; + align-items: flex-end; + height: 100%; + padding-bottom: 18px; + color: $color-dark; + text-decoration: none; + font-size: 12px; + font-weight: 700; + text-transform: uppercase; + letter-spacing: 0.5px; + transition: color $transition; + + &:hover { + color: $color-primary; + } + + &.is-active { + color: $color-primary; + border-bottom: 3px solid $color-primary; + } + } +} diff --git a/src/styles/index.scss b/src/styles/index.scss index 293d3b1f13..0068e54b24 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1,3 +1,12 @@ +@import 'variables'; + body { margin: 0; + font-family: Roboto, sans-serif; + background: $color-bg; } + +@import 'header'; +@import 'nav'; +@import 'card'; +@import 'catalog'; diff --git a/src/styles/variables.scss b/src/styles/variables.scss new file mode 100644 index 0000000000..f291c99845 --- /dev/null +++ b/src/styles/variables.scss @@ -0,0 +1,9 @@ +$color-primary: #00acdc; +$color-dark: #060b35; +$color-text-light: #999; +$color-bg: #f5f5f5; +$color-white: #fff; +$color-title-hover: #34568b; +$color-border: #e5e5e5; +$card-width: 200px; +$transition: 300ms;