Skip to content

Commit

Permalink
add product card
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasschumann committed Feb 3, 2025
1 parent 606dc21 commit 4f12f10
Show file tree
Hide file tree
Showing 4 changed files with 171 additions and 1 deletion.
49 changes: 48 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,59 @@
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:[email protected]&display=swap"
rel="stylesheet"
/>
<link
rel="stylesheet"
href="./styles/index.scss"
href="styles/index.scss"
/>
</head>
<body>
<h1>Product cards</h1>

<div
class="card"
data-qa="card"
>
<div class="card__image"></div>
<div class="card__title">
APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A)
</div>
<div class="card__code">Product code: 195434</div>
<div class="card__reviews">
<div class="stars">
<div class="stars__star"></div>
<div class="stars__star"></div>
<div class="stars__star"></div>
<div class="stars__star"></div>
<div class="stars__star"></div>
</div>
<div class="card__reviews-label">Reviews: 5</div>
</div>
<div class="card__price">
<div class="card__price-word">Price:</div>
<div class="card__price-value">$2,199</div>
</div>
<div>
<a
href="#"
class="card__buy-button"
data-qa="hover"
>
Buy
</a>
</div>
</div>
</body>
</html>
101 changes: 101 additions & 0 deletions src/styles/blocks/card.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
.card {
box-sizing: border-box;
background-color: white;
border-radius: 5px;
width: 200px;
height: 408px;
padding: 16px;
display: flex;
flex-direction: column;
border: 1px solid #f3f3f3;

&__image {
background-image: url(../images/imac.jpeg);
width: 100%;
height: 134px;
margin: 16px 0 40px;
background-size: contain;
background-repeat: no-repeat;
background-position: center;
}

&__title {
font-weight: 500;
margin-bottom: 4px;
line-height: 18px;
}

&__code {
margin-bottom: 16px;
}

&__code,
&__reviews-label {
font-size: 10px;
}

&__price-word,
&__title {
font-size: 12px;
}

&__price-value,
&__buy-button {
font-weight: 700;
}

&__reviews-label,
&__code,
&__price-word {
font-weight: 400;
}

&__title,
&__price-value,
&__reviews-label {
color: #060b35;
}

&__code,
&__price-word {
color: #616070;
}

&__reviews {
display: flex;
justify-content: space-between;
margin-bottom: 24px;
}

&__reviews-label {
align-self: flex-end;
}

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

&__buy-button {
color: white;
text-decoration: none;
background-color: #00acdc;
width: 100%;
height: 40px;
display: flex;
justify-content: center;
align-items: center;
border-radius: 5px;
border: 1px solid #00acdc;
box-sizing: border-box;
text-transform: uppercase;
font-size: 14px;
}

&__buy-button:hover {
background-color: white;
color: #00acdc;
}
}
18 changes: 18 additions & 0 deletions src/styles/blocks/stars.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.stars {
display: flex;
width: 96px;
justify-content: space-between;
align-self: flex-end;

&__star {
background-image: url(../images/star.svg);
background-repeat: no-repeat;
background-position: bottom;
width: 16px;
height: 16px;
}

&__star:nth-child(-n + 4) {
background-image: url(../images/star-active.svg);
}
}
4 changes: 4 additions & 0 deletions src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
body {
margin: 0;
font-family: Roboto, sans-serif;
}

@import 'blocks/card';
@import 'blocks/stars';

0 comments on commit 4f12f10

Please sign in to comment.