Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update product card layout and styles; upgrade @mate-academy/scripts … #5101

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/test.yml-template
Original file line number Diff line number Diff line change
@@ -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
9 changes: 5 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
"scripts": {
"init": "mate-scripts init",
"start": "mate-scripts start",
"dev": "parcel ./src/index.html --open",
"format": "prettier --ignore-path .prettierignore --write './src/**/*.{html,css,scss}'",
"lint": "npm run format && mate-scripts lint",
"test:only": "mate-scripts test",
"build": "mate-scripts build",
"build": "parcel build --public-url=/dist/",
"deploy": "mate-scripts deploy",
"update": "mate-scripts update",
"postinstall": "npm run update",
Expand All @@ -22,7 +23,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",
Expand Down
14 changes: 7 additions & 7 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ This is possible because [we use the Parcel library](https://en.parceljs.org/scs

❗️ Replace `<your_account>` with your GitHub username and copy the links to the `Pull Request` description:

- [DEMO LINK](https://<your_account>.github.io/layout_product-cards/)
- [TEST REPORT LINK](https://<your_account>.github.io/layout_product-cards/report/html_report/)
- [DEMO LINK](https://manuilenkoart.github.io/layout_product-cards/)
- [TEST REPORT LINK](https://manuilenkoart.github.io/layout_product-cards/report/html_report/)

❗️ Copy this `Checklist` to the `Pull Request` description after links, and put `- [x]` before each point after you checked it.

- [ ] there 2 BEM blocks `card` and `stars` each in their own file
- [ ] SCSS Nesting is used for `elements`, `modifiers` and `pseudo-classes`
- [ ] SCSS Variables are used for main values and placed in a **separate file**
- [ ] all `stars--N` modifiers work as expected (Highlight first `N` stars)
- [ ] Code follows all the [Code Style Rules ❗️](https://mate-academy.github.io/layout_task-guideline/html-css-code-style-rules)
- [x] there 2 BEM blocks `card` and `stars` each in their own file
- [x] SCSS Nesting is used for `elements`, `modifiers` and `pseudo-classes`
- [x] SCSS Variables are used for main values and placed in a **separate file**
- [x] all `stars--N` modifiers work as expected (Highlight first `N` stars)
- [x] Code follows all the [Code Style Rules ❗️](https://mate-academy.github.io/layout_task-guideline/html-css-code-style-rules)
53 changes: 52 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,63 @@
content="width=device-width, initial-scale=1.0"
/>
<title>Product cards</title>
<link
rel="preconnect"
href="https://fonts.googleapis.com"
/>
<link
rel="preconnect"
href="https://fonts.gstatic.com"
crossorigin="anonymous"
/>
<link
href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap"
rel="stylesheet"
/>
<link
rel="stylesheet"
href="./styles/index.scss"
/>
Manuilenkoart marked this conversation as resolved.
Show resolved Hide resolved
</head>
<body>
<h1>Product cards</h1>
<section
class="card"
data-qa="card"
>
<img
class="card__image"
src="/src/images/imac.jpeg"
alt="desktop"
/>
<h2 class="card__title">
APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A)
</h2>

<p class="card__code">Product code: 195434</p>

<div class="card__review">
<div class="stars stars--4">
<span class="stars__star"></span>
<span class="stars__star"></span>
<span class="stars__star"></span>
<span class="stars__star"></span>
<span class="stars__star"></span>
</div>

<p class="card__count">Reviews: 5</p>
</div>

<div class="card__price">
<p class="card__description">Price:</p>
<p class="card__value">$2,199</p>
</div>

<button
class="card__button"
data-qa="hover"
>
buy
</button>
</section>
</body>
</html>
85 changes: 85 additions & 0 deletions src/styles/card.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
@import './variables';

.card {
box-sizing: border-box;
border: 1px solid #f3f3f3;
width: 200px;
padding: 32px 16px 16px;
font-family: Roboto, sans-serif;

&__image {
width: 160px;
height: 134px;
display: block;
margin: auto auto 40px;
}

&__title {
color: $color-main;
Manuilenkoart marked this conversation as resolved.
Show resolved Hide resolved
margin-bottom: 4px;
font-size: 12px;
font-weight: 500;
line-height: 18px;
}

&__code {
font-size: 10px;
font-weight: 400;
line-height: 14px;
color: $color-secondary;
Manuilenkoart marked this conversation as resolved.
Show resolved Hide resolved
margin-bottom: 16px;
}

&__review {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 24px;
}

&__count {
font-size: 10px;
font-weight: 400;
line-height: 14px;
color: $color-main;
Manuilenkoart marked this conversation as resolved.
Show resolved Hide resolved
}

&__price {
display: flex;
justify-content: space-between;
margin-bottom: 16px;
}

&__description {
font-size: 12px;
font-weight: 400;
line-height: 18px;
color: $color-secondary;
Manuilenkoart marked this conversation as resolved.
Show resolved Hide resolved
}

&__value {
font-size: 16px;
font-weight: 700;
line-height: 18px;
color: $color-main;
Manuilenkoart marked this conversation as resolved.
Show resolved Hide resolved
}

&__button {
width: 100%;
text-transform: uppercase;
background-color: $blue-accent;
Manuilenkoart marked this conversation as resolved.
Show resolved Hide resolved
color: #fff;
border-radius: 5px;
padding: 12px 0;
border: 1px solid $blue-accent;
Manuilenkoart marked this conversation as resolved.
Show resolved Hide resolved
font-size: 14px;
font-weight: 700;

&:hover {
color: $blue-accent;
Manuilenkoart marked this conversation as resolved.
Show resolved Hide resolved
background-color: #fff;

cursor: pointer;
}
}
}
7 changes: 6 additions & 1 deletion src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
body {
@import './stars';
@import './card';

body,
h2,
p {
margin: 0;
}
18 changes: 18 additions & 0 deletions src/styles/stars.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.stars {
display: flex;

&__star {
background-image: url('../images/star.svg');
background-repeat: no-repeat;
background-position: 50%;
margin-right: 4px;
width: 16px;
height: 16px;
}

@for $activeStar from 1 through 4 {
&__star:nth-child(-n + #{$activeStar}) {
background-image: url('../images/star-active.svg');
}
}
}
3 changes: 3 additions & 0 deletions src/styles/variables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
$color-main: #060b35;
$color-secondary: #616070;
$blue-accent: #00acdc;
Loading