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/src/index.html b/src/index.html index 9cff78eeb7..8333585dfa 100644 --- a/src/index.html +++ b/src/index.html @@ -22,6 +22,342 @@ -

Catalog

+
+
+ + + + + +
+
+
+
+
+ Product image +
+ +
+ +
+

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

+ Product code: 195434 +
+ +
+
+ + + + + +
+ Reviews: 5 +
+ +
+ Price: + $2,199 +
+ + + +
+
+ +
+
+ Product image +
+ +
+ +
+

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

+ Product code: 195434 +
+ +
+
+ + + + + +
+ Reviews: 5 +
+ +
+ Price: + $2,199 +
+ + + +
+
+ +
+
+ Product image +
+ +
+ +
+

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

+ Product code: 195434 +
+ +
+
+ + + + + +
+ Reviews: 5 +
+ +
+ Price: + $2,199 +
+ + + +
+
+ +
+
+ Product image +
+ +
+ +
+

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

+ Product code: 195434 +
+ +
+
+ + + + + +
+ Reviews: 5 +
+ +
+ Price: + $2,199 +
+ + + +
+
+ +
+
+ Product image +
+ +
+ +
+

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

+ Product code: 195434 +
+ +
+
+ + + + + +
+ Reviews: 5 +
+ +
+ Price: + $2,199 +
+ + + +
+
+ +
+
+ Product image +
+ +
+ +
+

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

+ Product code: 195434 +
+ +
+
+ + + + + +
+ Reviews: 5 +
+ +
+ Price: + $2,199 +
+ + + +
+
+ +
+
+ Product image +
+ +
+ +
+

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

+ Product code: 195434 +
+ +
+
+ + + + + +
+ Reviews: 5 +
+ +
+ Price: + $2,199 +
+ + + +
+
+ +
+
+ Product image +
+ +
+ +
+

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

+ Product code: 195434 +
+ +
+
+ + + + + +
+ Reviews: 5 +
+ +
+ Price: + $2,199 +
+ + + +
+
+ +
+ + + + diff --git a/src/styles/_base.scss b/src/styles/_base.scss new file mode 100644 index 0000000000..d5204fb98d --- /dev/null +++ b/src/styles/_base.scss @@ -0,0 +1,5 @@ +body { + margin: 0; + font-family: $font-main; + font-weight: 500; + } \ No newline at end of file diff --git a/src/styles/_button.scss b/src/styles/_button.scss new file mode 100644 index 0000000000..66bfc7e496 --- /dev/null +++ b/src/styles/_button.scss @@ -0,0 +1,27 @@ +.button { + width: 100%; + height: 40px; + display: flex; + justify-content: center; + align-items: center; + + background-color: $color-primary; + color: $color-white; + border: 1px solid transparent; + border-radius: 5px; + cursor: pointer; + transition: background-color 300ms ease, color 300ms ease, border-color 300ms ease; + + font-family: $font-main; + font-size: 14px; + font-weight: 700; + line-height: 1.14; + text-transform: uppercase; + + &:hover { + background-color: $color-white; + color: $color-primary; + border: 1px solid $color-primary; + text-decoration: none; + } +} diff --git a/src/styles/_card.scss b/src/styles/_card.scss new file mode 100644 index 0000000000..c5c05266fe --- /dev/null +++ b/src/styles/_card.scss @@ -0,0 +1,77 @@ +.card { + width: $card-width; + border: 1px solid $color-border; + border-radius: 16px; + padding: 16px 8px; + font-family: $font-main; + color: $color-text; + box-sizing: border-box; + background-color: $color-white; + overflow: hidden; + + transition: transform 300ms ease; + + &__image { + display: flex; + justify-content: center; + margin-top: 17px; + margin-bottom: 40px; + + img { + width: 160px; + height: 134px; + object-fit: contain; + } + } + + &__content { + display: flex; + flex-direction: column; + margin: 0 8px; + } + + &__header { + display: flex; + flex-direction: column; + gap: 4px; + margin-bottom: 16px; + } + + &__title { + margin: 0; + font-family: $font-main; + font-size: 12px; + font-weight: 500; + line-height: 1.5; + color: $color-text; + letter-spacing: 0; + + transition: color 300ms ease; + } + + &__sku { + margin: 0; + font-family: $font-main; + font-size: 10px; + line-height: 1.4; + font-weight: 400; + color: $color-text-secondary; + letter-spacing: 0; + } + + &__reviews { + margin-bottom: 24px; + } + + &__price { + margin-bottom: 16px; + } + + &:hover { + transform: scale(1.2); + + .card__title { + color: #34568b; + } + } +} \ No newline at end of file diff --git a/src/styles/_catalog.scss b/src/styles/_catalog.scss new file mode 100644 index 0000000000..e727bf5b12 --- /dev/null +++ b/src/styles/_catalog.scss @@ -0,0 +1,23 @@ +.catalog { + padding: 50px 40px; + + display: grid; + + grid-template-columns: $card-width; + + gap: 46px 48px; + + justify-content: center; + + @media (min-width: 488px) { + grid-template-columns: repeat(2, $card-width); + } + + @media (min-width: 768px) { + grid-template-columns: repeat(3, $card-width); + } + + @media (min-width: 1024px) { + grid-template-columns: repeat(4, $card-width); + } + } \ No newline at end of file diff --git a/src/styles/_header.scss b/src/styles/_header.scss new file mode 100644 index 0000000000..4a7be4e789 --- /dev/null +++ b/src/styles/_header.scss @@ -0,0 +1,62 @@ +.header { + width: 100%; + background-color: $color-white; + border-bottom: 1px solid rgba(0, 0, 0, 0.1); + + &__container { + max-width: 1200px; + margin: 0 auto; + padding: 0 16px; + display: flex; + justify-content: space-between; + align-items: center; + } + } + + .nav { + text-transform: uppercase; + + &__list { + display: flex; + align-items: center; + list-style: none; + margin: 0; + padding: 0; + } + + &__item { + margin-left: 24px; + + &:first-child { + margin-left: 0; + } + } + + &__link { + text-decoration: none; + color: $color-text; + transition: color $transition-time ease; + height: 80px; + display: flex; + align-items: center; + + &:hover { + color: $color-primary; + } + + &.is-active { + position: relative; + color: $color-primary; + + &::after { + content: ""; + position: absolute; + left: 0; + bottom: 0; + width: 100%; + height: 4px; + background-color: $color-primary; + } + } + } + } \ No newline at end of file diff --git a/src/styles/_price.scss b/src/styles/_price.scss new file mode 100644 index 0000000000..1093affbcf --- /dev/null +++ b/src/styles/_price.scss @@ -0,0 +1,21 @@ +.price { + display: flex; + align-items: baseline; + justify-content: space-between; + + &__label { + font-family: $font-main; + font-weight: 400; + font-size: 12px; + line-height: 1.5; + color: $color-text-secondary; + } + + &__value { + font-family: $font-main; + font-size: 18px; + font-weight: 700; + color: $color-text; + line-height: 1; + } +} diff --git a/src/styles/_reviews.scss b/src/styles/_reviews.scss new file mode 100644 index 0000000000..033d2342f5 --- /dev/null +++ b/src/styles/_reviews.scss @@ -0,0 +1,12 @@ +.reviews { + display: flex; + align-items: center; + justify-content: space-between; + + &__count { + font-size: 10px; + line-height: 1.4; + color: $color-text-secondary; + font-family: $font-main; + } +} diff --git a/src/styles/_stars.scss b/src/styles/_stars.scss new file mode 100644 index 0000000000..35f11bb9e0 --- /dev/null +++ b/src/styles/_stars.scss @@ -0,0 +1,34 @@ +.stars { + display: flex; + gap: 4px; + + &__item { + display: inline-block; + width: 12px; + height: 12px; + background-image: url('../images/star.svg'); + background-repeat: no-repeat; + background-size: contain; + } + + + &--1 { + .stars__item:nth-child(-n+1) { background-image: url('../images/star-active.svg'); } + } + + &--2 { + .stars__item:nth-child(-n+2) { background-image: url('../images/star-active.svg'); } + } + + &--3 { + .stars__item:nth-child(-n+3) { background-image: url('../images/star-active.svg'); } + } + + &--4 { + .stars__item:nth-child(-n+4) { background-image: url('../images/star-active.svg'); } + } + + &--5 { + .stars__item:nth-child(-n+5) { background-image: url('../images/star-active.svg'); } + } +} \ No newline at end of file diff --git a/src/styles/_variables.scss b/src/styles/_variables.scss new file mode 100644 index 0000000000..1ddf36dac0 --- /dev/null +++ b/src/styles/_variables.scss @@ -0,0 +1,8 @@ +$font-main: 'Roboto', sans-serif; +$color-primary: #00ACDC; +$color-text: #060B35; +$color-white: #fff; +$color-text-secondary: #616070; +$card-width: 200px; +$color-border: #F3F3F3; +$transition-time: 300ms; diff --git a/src/styles/index.scss b/src/styles/index.scss index 293d3b1f13..88798fc337 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1,3 +1,9 @@ -body { - margin: 0; -} +@import 'variables'; +@import 'base'; +@import 'header'; +@import 'button'; +@import 'card'; +@import 'price'; +@import 'reviews'; +@import 'stars'; +@import 'catalog'; \ No newline at end of file