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..52915e2597 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://.github.io/layout_catalog/) +- [TEST REPORT LINK](https://.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..9985ac4b20 100644 --- a/src/index.html +++ b/src/index.html @@ -20,8 +20,418 @@ href="styles/index.scss" /> - -

Catalog

+
+ + + + +
+ +
+
+
+
+ iMac +
+ +
Product code: 195434
+
+
+
+
+
+
+
+
+
Reviews: 5
+
+
+
Price:
+
$2,199
+
+ + Buy + +
+
+ +
+
+
+ iMac +
+ +
Product code: 195434
+
+
+
+
+
+
+
+
+
Reviews: 5
+
+
+
Price:
+
$2,199
+
+ + Buy + +
+
+ +
+
+
+ iMac +
+ +
Product code: 195434
+
+
+
+
+
+
+
+
+
Reviews: 5
+
+
+
Price:
+
$2,199
+
+ + Buy + +
+
+ +
+
+
+ iMac +
+ +
Product code: 195434
+
+
+
+
+
+
+
+
+
Reviews: 5
+
+
+
Price:
+
$2,199
+
+ + Buy + +
+
+ +
+
+
+ iMac +
+ +
Product code: 195434
+
+
+
+
+
+
+
+
+
Reviews: 5
+
+
+
Price:
+
$2,199
+
+ + Buy + +
+
+ +
+
+
+ iMac +
+ +
Product code: 195434
+
+
+
+
+
+
+
+
+
Reviews: 5
+
+
+
Price:
+
$2,199
+
+ + Buy + +
+
+ +
+
+
+ iMac +
+ +
Product code: 195434
+
+
+
+
+
+
+
+
+
Reviews: 5
+
+
+
Price:
+
$2,199
+
+ + Buy + +
+
+ +
+
+
+ iMac +
+ +
Product code: 195434
+
+
+
+
+
+
+
+
+
Reviews: 5
+
+
+
Price:
+
$2,199
+
+ + Buy + +
+
+
diff --git a/src/styles/card.scss b/src/styles/card.scss new file mode 100644 index 0000000000..05224915d1 --- /dev/null +++ b/src/styles/card.scss @@ -0,0 +1,124 @@ +.card { + box-sizing: border-box; + width: 200px; + height: 408px; + border: 1px solid $border-color; + border-radius: 5px; + background-color: #fff; + + &__content { + height: 100%; + transition: transform 300ms; + } + + &__content:hover { + transform: scale(1.2); + } + + &__image { + margin: 32px 19px 40px; + } + + &__photo { + display: block; + object-fit: cover; + object-position: center; + width: 160px; + height: 134px; + } + + &__title { + font-size: 12px; + font-weight: 500; + line-height: 18px; + letter-spacing: 0; + margin: 0 16px 4px; + } + + &__link { + display: block; + text-decoration: none; + color: $color-main; + } + + &__description { + display: block; + font-size: 10px; + font-weight: 400; + line-height: 14px; + letter-spacing: 0; + color: $color-secondary; + margin: 0 16px 16px; + } + + &__info { + display: flex; + justify-content: space-between; + align-items: center; + margin: 0 16px 24px; + } + + &__reviews { + transform: translateY(1px); + font-size: 10px; + font-weight: 400; + line-height: 14px; + letter-spacing: 0; + color: $color-main; + margin-left: 17px; + } + + &__price { + display: flex; + justify-content: space-between; + margin: 0 16px 16px; + + &-label { + font-size: 12px; + font-weight: 400; + line-height: 18px; + letter-spacing: 0; + color: $color-secondary; + } + + &-value { + font-size: 16px; + font-weight: 700; + line-height: 18px; + letter-spacing: 0; + color: $color-main; + } + } + + &__buy { + box-sizing: border-box; + border: 1px solid $color-accent; + display: flex; + justify-content: center; + align-items: center; + + width: 166px; + height: 40px; + border-radius: 5px; + background-color: $color-accent; + margin: 0 16px 16px; + + color: $color-main-button; + font-size: 14px; + font-weight: 700; + line-height: 16px; + letter-spacing: 0; + text-decoration: none; + text-transform: uppercase; + + &:hover { + background-color: $background-color-hover; + border-color: $color-accent; + color: $color-accent; + } + } +} + +.card:hover .card__link { + color: $color-link-card-hover; +} diff --git a/src/styles/header.scss b/src/styles/header.scss new file mode 100644 index 0000000000..fa4fd8ac01 --- /dev/null +++ b/src/styles/header.scss @@ -0,0 +1,62 @@ +.header { + box-sizing: border-box; + width: 100%; + display: flex; + align-items: center; + justify-content: space-between; + padding: 0 50px; +} + +.header__logo { + display: block; + width: 40px; + height: 40px; +} + +.nav { + &__list { + display: flex; + list-style: none; + margin: 0; + padding: 0; + } + + &__link { + display: block; + line-height: 60px; + text-transform: uppercase; + text-decoration: none; + font-weight: 500; + font-size: 12px; + color: $color-main; + } + + &__link:hover { + color: $moyo-blue; + } + + &__item { + margin-right: 20px; + } + + &__item:last-child { + margin-right: 0; + } + + &__link.is-active { + position: relative; + color: $moyo-blue; + } + + .is-active::after { + content: ''; + position: absolute; + display: block; + background-color: $moyo-blue; + left: 0; + bottom: 0; + width: 100%; + height: 4px; + border-radius: 8px; + } +} diff --git a/src/styles/index.scss b/src/styles/index.scss index 293d3b1f13..e48e799e33 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1,3 +1,5 @@ -body { - margin: 0; -} +@import './variables'; +@import './header'; +@import './page'; +@import './stars'; +@import './card'; diff --git a/src/styles/page.scss b/src/styles/page.scss new file mode 100644 index 0000000000..21705736b0 --- /dev/null +++ b/src/styles/page.scss @@ -0,0 +1,31 @@ +body { + margin: 0; + padding: 0; + font-family: Roboto, Arial, sans-serif; +} + +.catalog { + display: grid; + padding: 50px 40px; + grid-template-columns: repeat(1, 200px); + gap: 46px 48px; + justify-content: center; +} + +@media (min-width: 488px) { + .catalog { + grid-template-columns: repeat(2, 200px); + } +} + +@media (min-width: 768px) { + .catalog { + grid-template-columns: repeat(3, 200px); + } +} + +@media (min-width: 1024px) { + .catalog { + grid-template-columns: repeat(4, 200px); + } +} diff --git a/src/styles/stars.scss b/src/styles/stars.scss new file mode 100644 index 0000000000..7fb4fa20da --- /dev/null +++ b/src/styles/stars.scss @@ -0,0 +1,22 @@ +.stars { + display: flex; + + &__star { + width: 16px; + height: 16px; + background-image: url(../images/star.svg); + background-repeat: no-repeat; + margin-right: 4px; + background-position: center; + } + + &__star:last-child { + margin-right: 0; + } + + @for $i from 1 through 5 { + &--#{$i} &__star:nth-child(-n + #{$i}) { + 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..3e1a98880f --- /dev/null +++ b/src/styles/variables.scss @@ -0,0 +1,8 @@ +$moyo-blue: #00acdc; +$color-main: #060b35; +$color-secondary: #616070; +$color-accent: #00acdc; +$color-main-button: #fff; +$border-color: #f3f3f3; +$background-color-hover: #fff; +$color-link-card-hover: #34568b;