Skip to content

Commit

Permalink
Update product card layout and styles; upgrade @mate-academy/scripts …
Browse files Browse the repository at this point in the history
…version
  • Loading branch information
artur.manuilenko committed Dec 23, 2024
1 parent 606dc21 commit f6c109d
Show file tree
Hide file tree
Showing 9 changed files with 201 additions and 9 deletions.
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.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ 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.

Expand Down
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"
/>
</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;
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;
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;
}

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

&__description {
font-size: 12px;
font-weight: 400;
line-height: 18px;
color: $color-secondary;
}

&__value {
font-size: 16px;
font-weight: 700;
line-height: 18px;
color: $color-main;
}

&__button {
width: 100%;
text-transform: uppercase;
background-color: $blue-accent;
color: #fff;
border-radius: 5px;
padding: 12px 0;
border: 1px solid $blue-accent;
font-size: 14px;
font-weight: 700;

&:hover {
color: $blue-accent;
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;

0 comments on commit f6c109d

Please sign in to comment.