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..664cd93eb5 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", 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..e7e274fc8e 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` @@ -33,8 +33,8 @@ 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/) +- [DEMO LINK](https://nikitinaanna47.github.io/layout_catalog/) +- [TEST REPORT LINK](https://nikitinaanna47.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. diff --git a/src/index.html b/src/index.html index 9cff78eeb7..be7aecd07a 100644 --- a/src/index.html +++ b/src/index.html @@ -22,6 +22,370 @@ -

Catalog

+
+ + + +
+ +
+
+
+
+ apple +
+
+
+ APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A) +
+
Product code: 195434
+
+
+
+
+
+
+
+
+
+
Reviews: 5
+
+
+
Price:
+
$2,199
+
+ + BUY + +
+ +
+
+ apple +
+
+
+ APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A) +
+
Product code: 195434
+
+
+
+
+
+
+
+
+
+
Reviews: 5
+
+
+
Price:
+
$2,199
+
+ + BUY + +
+ +
+
+ apple +
+
+
+ APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A) +
+
Product code: 195434
+
+
+
+
+
+
+
+
+
+
Reviews: 5
+
+
+
Price:
+
$2,199
+
+ + BUY + +
+ +
+
+ apple +
+
+
+ APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A) +
+
Product code: 195434
+
+
+
+
+
+
+
+
+
+
Reviews: 5
+
+
+
Price:
+
$2,199
+
+ + BUY + +
+ +
+
+ apple +
+
+
+ APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A) +
+
Product code: 195434
+
+
+
+
+
+
+
+
+
+
Reviews: 5
+
+
+
Price:
+
$2,199
+
+ + BUY + +
+ +
+
+ apple +
+
+
+ APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A) +
+
Product code: 195434
+
+
+
+
+
+
+
+
+
+
Reviews: 5
+
+
+
Price:
+
$2,199
+
+ + BUY + +
+ +
+
+ apple +
+
+
+ APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A) +
+
Product code: 195434
+
+
+
+
+
+
+
+
+
+
Reviews: 5
+
+
+
Price:
+
$2,199
+
+ + BUY + +
+ +
+
+ apple +
+
+
+ APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A) +
+
Product code: 195434
+
+
+
+
+
+
+
+
+
+
Reviews: 5
+
+
+
Price:
+
$2,199
+
+ + BUY + +
+
+
diff --git a/src/styles/button.scss b/src/styles/button.scss new file mode 100644 index 0000000000..1b5382b0ac --- /dev/null +++ b/src/styles/button.scss @@ -0,0 +1,24 @@ +@use './variables.scss' as *; + +.button { + display: flex; + align-items: center; + justify-content: center; + background-color: $blue; + border-radius: 5px; + box-sizing: border-box; + + font-weight: 700; + font-size: 14px; + color: white; + + &:link { + text-decoration: none; + } + + &:hover { + background-color: white; + border: solid $blue 1px; + color: $blue; + } +} diff --git a/src/styles/header.scss b/src/styles/header.scss new file mode 100644 index 0000000000..db63311a06 --- /dev/null +++ b/src/styles/header.scss @@ -0,0 +1,69 @@ +@use './variables.scss' as *; + +.header { + display: flex; + align-items: center; + justify-content: space-between; + + padding: 0 50px; +} + +.logo { + display: flex; + align-items: center; + background-color: white; + position: relative; +} + +.nav { + display: flex; +} + +.nav__box { + display: flex; + flex-direction: column; + + margin: 0 10px; +} + +.nav__link { + display: flex; + align-items: center; + position: relative; + height: $header-height; + + margin: 0 10px; + + font-size: 12px; + color: $main-color; + text-decoration: none; + transition: color 300ms ease; +} + +.nav__link:first-child { + margin-left: 0; +} + +.nav__link:last-child { + margin-right: 0; +} + +.nav__link:hover { + color: $blue; +} + +.nav__link.is-active { + color: $blue; +} + +.nav__link.is-active::after { + content: ''; + display: block; + position: absolute; + bottom: 0; + + width: 100%; + height: 4px; + + background-color: $blue; +} diff --git a/src/styles/index.scss b/src/styles/index.scss index 293d3b1f13..54347b3653 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1,3 +1,15 @@ +@use './button.scss'; +@use './header.scss'; +@use './main.scss'; +@use './product-card.scss'; +@use './stars.scss'; +@use './variables.scss' as *; + body { margin: 0; + box-sizing: border-box; + + font-family: Roboto, sans-serif; + font-weight: 500; + color: $main-color; } diff --git a/src/styles/main.scss b/src/styles/main.scss new file mode 100644 index 0000000000..d4582f0d00 --- /dev/null +++ b/src/styles/main.scss @@ -0,0 +1,32 @@ +@use './variables.scss' as *; + +.main { + box-sizing: border-box; + display: grid; + max-width: $main-content-max-width; + + padding: $main-y-padding $main-x-padding; + gap: $main-y-gap $main-x-gap; + + margin: 0 auto; + + grid-template-columns: repeat(1, $card-width); +} + +@media (min-width: 488px) { + .main { + grid-template-columns: repeat(2, $card-width); + } +} + +@media (min-width: 768px) { + .main { + grid-template-columns: repeat(3, $card-width); + } +} + +@media (min-width: 1024px) { + .main { + grid-template-columns: repeat(4, $card-width); + } +} diff --git a/src/styles/product-card.scss b/src/styles/product-card.scss new file mode 100644 index 0000000000..9ecd44cd10 --- /dev/null +++ b/src/styles/product-card.scss @@ -0,0 +1,104 @@ +@use './variables.scss' as *; + +.product-card { + display: flex; + flex-direction: column; + align-items: center; + box-sizing: border-box; + border: 1px solid #f3f3f3; + border-radius: 5px; + width: $card-width; + padding: $card-padding; + + transition: transform 300ms ease; + + [class*='product-card__'] { + width: 100%; + box-sizing: border-box; + } + + &__product-photo { + display: flex; + align-items: center; + justify-content: center; + margin-top: 16px; + + > img { + width: 160px; + height: 134px; + } + } + + &__name-section { + display: flex; + flex-direction: column; + margin-top: 40px; + } + + &__title { + font-weight: 500; + font-size: 12px; + line-height: 18px; + color: $main-color; + transition: color 300ms ease; + } + + &__code { + margin-top: 4px; + font-weight: 400; + font-size: 10px; + line-height: 14px; + color: $grey; + } + + &__rate-section { + display: flex; + justify-content: space-between; + align-items: center; + margin-top: 16px; + box-sizing: border-box; + } + + &__reviews { + font-weight: 400; + font-size: 10px; + line-height: 14px; + color: $main-color; + } + + &__price-section { + display: flex; + justify-content: space-between; + align-items: center; + margin-top: 24px; + box-sizing: border-box; + } + + &__label { + font-weight: 400; + font-size: 12px; + line-height: 18px; + color: $grey; + } + + &__amount { + font-weight: 700; + font-size: 16px; + line-height: 18px; + color: $main-color; + } + + &__button { + margin-top: 16px; + height: 40px; + } + + &:hover { + transform: scale(1.2); + z-index: 10; + + .product-card__title { + color: #34568b; + } + } +} diff --git a/src/styles/stars.scss b/src/styles/stars.scss new file mode 100644 index 0000000000..873ea5b76c --- /dev/null +++ b/src/styles/stars.scss @@ -0,0 +1,34 @@ +@use './variables.scss' as *; + +:root { + --box-padding: 22px; + --star-squer-side: 16px; + --gap-betwen-stars: 4px; +} + +.stars { + display: flex; + box-sizing: border-box; +} + +.stars > div { + background-repeat: no-repeat; + background-position-x: center; + background-position-y: center; + width: var(--star-squer-side); + height: var(--star-squer-side); + margin-left: var(--gap-betwen-stars); + background-image: url('../images/star.svg'); +} + +.stars > div:first-child { + margin-left: 0; +} + +.stars--1 > div:nth-child(-n + 1), +.stars--2 > div:nth-child(-n + 2), +.stars--3 > div:nth-child(-n + 3), +.stars--4 > div:nth-child(-n + 4), +.stars--5 > div:nth-child(-n + 5) { + 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..0207d528dd --- /dev/null +++ b/src/styles/variables.scss @@ -0,0 +1,16 @@ +$header-height: 60px; +$card-width: 200px; +$card-padding: 16px; +$card-photo-width: 160px; +$card-content-width: 166px; +$main-max-colums-number: 4; +$main-x-padding: 40px; +$main-y-padding: 50px; +$main-x-gap: 48px; +$main-y-gap: 46px; +$main-air: $main-x-gap * ($main-max-colums-number - 1) + $main-x-padding * 2; +$main-content-max-width: $main-max-colums-number * $card-width + $main-air; +$main-color: #060b35; +$blue: #00acdc; +$grey: #616070; +$black: black;