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

Product card #5120

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
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://DeJisk.github.io/layout_product-cards/)
- [TEST REPORT LINK](https://DeJisk.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
68 changes: 66 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,76 @@
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"
/>
<link
href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;0,500;0,700;0,900;1,700;1,900&display=swap"
rel="stylesheet"
/>
<link
rel="preconnect"
href="https://fonts.googleapis.com"
/>
<link
rel="preconnect"
href="https://fonts.gstatic.com"
/>
Comment on lines +22 to +29

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are duplicate preconnect links to Google Fonts. You only need one preconnect link for each unique domain. Consider removing the redundant preconnect links to optimize performance.

<link
href="https://fonts.googleapis.com/css2?family=Inria+Serif&display=swap"
rel="stylesheet"
/>
<link
rel="stylesheet"
href="./styles/index.scss"
/>
</head>
<body>
<h1>Product cards</h1>
<body class="page">
<div
class="card"
data-qa="card"
>
<div class="card__container">
<img
src="images/imac.jpeg"
alt="imac"
class="card__image"
/>
</div>

<div class="card__title">
APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A)
</div>

<div class="card__subtitle">Product code: 195434</div>

<div class="card__activity">
<div class="card__rating rating">
<div class="rating__star"></div>
<div class="rating__star"></div>
<div class="rating__star"></div>
<div class="rating__star"></div>
<div class="rating__star"></div>
</div>
<div class="card__review">Reviews: 5</div>
</div>

<div class="card__price">
<div class="card__sum-title">Price:</div>
<div class="card__sum">$2,199</div>
</div>

<button
data-qa="hover"
class="button button--hover"
>
Buy
</button>
</div>
</body>
</html>
22 changes: 22 additions & 0 deletions src/styles/button.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.button {
box-sizing: border-box;
display: block;
padding: 12px 69.5px;
color: #fff;
font-size: 14px;
font-weight: 700;
text-align: center;
outline: none;
border-radius: 5px;
background-color: #00acdc;
cursor: pointer;
text-transform: uppercase;
max-width: 166px;
border: 1px solid #00acdc;
height: 40px;

&--hover:hover {
background-color: #fff;
color: #00acdc;
}
}
75 changes: 75 additions & 0 deletions src/styles/card.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
.card {
display: flex;
flex-direction: column;
padding-inline: 16px;
padding-block: 32px 16px;
width: 200px;
border-radius: 5px;
border: 1px solid #f3f3f3;
box-sizing: border-box;

&__container {
max-width: 160px;
flex: 0 1 134px;
margin-inline: auto;
margin-bottom: 40px;
}

&__image {
width: 100%;
height: 100%;
display: block;
}

&__title {
font-size: 12px;
font-weight: 500;
line-height: 18px;
color: #060b35;
margin-bottom: 4px;
text-align: start;
}

&__subtitle {
font-size: 10px;
font-weight: 400;
line-height: 14px;
color: #616070;
margin-bottom: 16px;
}

&__activity,
&__price {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}

&__activity {
margin-bottom: 24px;
}

&__review {
font-size: 10px;
font-weight: 400;
color: #060b35;
}

&__price {
margin-bottom: 16px;
}

&__sum-title {
font-size: 12px;
font-weight: 400;
line-height: 18px;
color: #616070;
}
&__sum {
font-size: 16px;
font-weight: 700;
line-height: 18px;
color: #060b35;
}
}
7 changes: 4 additions & 3 deletions src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
body {
margin: 0;
}
@import 'card';
@import 'page';
@import 'button';
@import 'rating';
6 changes: 6 additions & 0 deletions src/styles/page.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.page {
font-family: Roboto, 'Inria Serif', serif;
margin: 0;
padding: 0;
box-sizing: border-box;
}
22 changes: 22 additions & 0 deletions src/styles/rating.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.rating {
display: flex;
flex-direction: row;

&__star {
width: 16px;
height: 16px;
background-repeat: no-repeat;
background-position: center;
}

&__star:not(:last-child) {
margin-right: 4px;
}

&__star:nth-child(-n + 4) {
background-image: url(../images/star-active.svg);
}
&__star:nth-child(5) {
background-image: url(../images/star.svg);
}
}
Loading