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..c9d205a795 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", @@ -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": "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 34398805fa..e25ee5cdde 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 874ca70d97..73ee39db05 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,6 @@ # Frontend practice with catalog page -Create an HTML page with a catalog. Develop semantic page structure as shown on [the mockup](https://www.figma.com/file/ojkArVazq7vsX0nbpn9CxZ/Moyo-%2F-Catalog-(ENG)?node-id=32249%3A354). +Create an HTML page with a catalog. Develop semantic page structure as shown on [the mockup](). - use `Header`, `Stars` and `Card` blocks from previous tasks but rewrite them using BEM and SCSS - remove old `data-qa` attributes @@ -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` @@ -20,6 +20,7 @@ Create an HTML page with a catalog. Develop semantic page structure as shown on - cards container(catalog) have fixed paddings (`50px` vertically and `40px` horizontally) Make all the changes smooth on hover (during 300ms): + - increase the card by 20 percent (neighboring cards **should not be** affected) - change the card title text color to `#34568b` when the card is hovered (`.card:hover .card__title`) - change navigation link text color to `#00acdc` @@ -27,20 +28,21 @@ Make all the changes smooth on hover (during 300ms): > Here are the [Layout Tasks Instructions](https://mate-academy.github.io/layout_task-guideline) -*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_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. -- [ ] 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..a89efb4c90 100644 --- a/src/index.html +++ b/src/index.html @@ -22,6 +22,347 @@ -

Catalog

+
+
+ + Logo by company MOYO, blue with black characthercs + + +
+
+
+
+ Bild iMac APPLE A1419 iMac 27 Retina 5K Monoblock (MNED2UA/A) +

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

+

Product code: 195434

+
+
+
+
+
+
+
+
+

Reviews: 5

+
+
+

Price:

+

$2,199

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

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

+

Product code: 195434

+
+
+
+
+
+
+
+
+

Reviews: 5

+
+
+

Price:

+

$2,199

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

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

+

Product code: 195434

+
+
+
+
+
+
+
+
+

Reviews: 5

+
+
+

Price:

+

$2,199

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

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

+

Product code: 195434

+
+
+
+
+
+
+
+
+

Reviews: 5

+
+
+

Price:

+

$2,199

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

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

+

Product code: 195434

+
+
+
+
+
+
+
+
+

Reviews: 5

+
+
+

Price:

+

$2,199

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

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

+

Product code: 195434

+
+
+
+
+
+
+
+
+

Reviews: 5

+
+
+

Price:

+

$2,199

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

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

+

Product code: 195434

+
+
+
+
+
+
+
+
+

Reviews: 5

+
+
+

Price:

+

$2,199

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

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

+

Product code: 195434

+
+
+
+
+
+
+
+
+

Reviews: 5

+
+
+

Price:

+

$2,199

+
+ +
+
+
+ +
diff --git a/src/styles/base/_base.scss b/src/styles/base/_base.scss new file mode 100644 index 0000000000..790a1563a4 --- /dev/null +++ b/src/styles/base/_base.scss @@ -0,0 +1,7 @@ +@use '../base/variables' as var; + +body { + margin: 0; + font-family: var.$fonts; + color: var.$color__black; +} diff --git a/src/styles/base/_reset.scss b/src/styles/base/_reset.scss new file mode 100644 index 0000000000..d13b9a4c78 --- /dev/null +++ b/src/styles/base/_reset.scss @@ -0,0 +1,7 @@ +* { + margin: 0; + padding: 0; + box-sizing: border-box; + list-style-type: none; + text-decoration: none; +} diff --git a/src/styles/base/_variables.scss b/src/styles/base/_variables.scss new file mode 100644 index 0000000000..f2f4d6b02e --- /dev/null +++ b/src/styles/base/_variables.scss @@ -0,0 +1,8 @@ +$fonts: Roboto, sans-serif; +$color__black: #060b35; +$color__blue: #00acdc; +$color__white: #fff; +$color__gray: #616070; +$header__box-shadow: rgba(0, 0, 0, 0.05); +$border-color: #f3f3f3; +$global-radius: 5px; diff --git a/src/styles/components/_header.scss b/src/styles/components/_header.scss new file mode 100644 index 0000000000..f2dc8ca2e6 --- /dev/null +++ b/src/styles/components/_header.scss @@ -0,0 +1,58 @@ +@use '../base/variables' as var; + +.header { + display: flex; + align-items: center; + justify-content: space-between; + width: 100%; + padding: 0 50px; + box-shadow: 0 2px 4px var.$header__box-shadow; + + &__logo-link { + display: flex; + } +} + +.nav { + &__item { + position: relative; + &:not(:first-child) { + margin-left: 20px; + } + } + + &__list { + display: flex; + align-items: center; + } + + &__link { + display: block; + font-size: 12px; + font-weight: 500; + color: var.$color__black; + height: 60px; + line-height: 60px; + text-transform: uppercase; + + &.is-active { + color: var.$color__blue; + + &::after { + position: absolute; + content: ''; + background-color: var.$color__blue; + border-radius: 8px; + width: 100%; + height: 4px; + bottom: 0; + left: 0; + } + } + + &:hover, + &:focus { + color: var.$color__blue; + } + } +} diff --git a/src/styles/components/_main.scss b/src/styles/components/_main.scss new file mode 100644 index 0000000000..93d9a36384 --- /dev/null +++ b/src/styles/components/_main.scss @@ -0,0 +1,131 @@ +@use '../base/variables' as var; + +.main { + background-color: var.$color__white; + font-weight: 400; +} + +.cards { + display: grid; + grid-template-columns: repeat(1, 200px); + gap: 46px 48px; + justify-content: center; + align-items: center; + padding: 50px 40px; + + &__laptop { + width: 200px; + background-color: var.$color__white; + border-radius: var.$global-radius; + border: 1px solid var.$border-color; + grid-column: span 1; + cursor: pointer; + transition: 0.3s; + + &-image { + width: 160px; + height: 134px; + margin: 32px 19px 36px; + } + &-titel { + font-weight: 500; + font-size: 12px; + margin: 0 16px; + line-height: 18px; + margin-bottom: 4px; + } + &-code { + font-size: 10px; + line-height: 14px; + color: var.$color__gray; + margin-left: 16px; + margin-bottom: 16px; + } + } + + &__reviews { + display: flex; + align-items: flex-end; + justify-content: space-between; + margin: 0 16px 24px; + height: 16px; + &-stars { + display: flex; + .star { + background-image: url(../images/star.svg); + background-repeat: no-repeat; + background-position: center; + height: 16px; + width: 16px; + margin-right: 4px; + border-radius: 0.5px; + &--active { + background-image: url(../images/star-active.svg); + } + } + } + + &-text { + font-size: 10px; + line-height: 14px; + text-align: right; + } + } + + &__price { + display: flex; + justify-content: space-between; + line-height: 18px; + margin: 0 16px 16px; + + &-text { + font-size: 12px; + font-weight: 400; + color: var.$color__gray; + } + + &-sum { + font-weight: 700; + font-size: 16px; + } + } + + &__button { + width: 166px; + height: 40px; + color: var.$color__white; + background-color: var.$color__blue; + font-size: 14px; + line-height: 16px; + font-weight: 700; + text-transform: uppercase; + text-align: center; + border: none; + border-radius: var.$global-radius; + cursor: pointer; + margin: 0 16px 16px; + + &:hover { + background-color: var.$color__white; + color: var.$color__blue; + border: 1px solid var.$color__blue; + } + } + + @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); + } +} + +.cards__laptop:hover .cards__laptop-titel { + transform: scale(1.2); + color: #34568b; +} diff --git a/src/styles/index.scss b/src/styles/index.scss index 293d3b1f13..7d9804c51b 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1,3 +1,5 @@ -body { - margin: 0; -} +@use './base/base'; +@use './base/reset'; +@use './base/variables' as var; +@use './components/header'; +@use './components/main';