Skip to content

Commit

Permalink
add task solution
Browse files Browse the repository at this point in the history
  • Loading branch information
mrsBlackA committed Oct 13, 2024
1 parent a19f710 commit 4d31931
Show file tree
Hide file tree
Showing 8 changed files with 241 additions and 5 deletions.
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ Create a pages with product card using `flexbox`, `BEM` and `SCSS` based on [thi

❗️ Replace `<your_account>` with your Github username and copy the links to `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://mrsBlackA.github.io/layout_product-cards/)
- [TEST REPORT LINK](https://mrsBlackA.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
76 changes: 73 additions & 3 deletions src/index.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,88 @@
<!doctype html>
<html lang="en">
<html
lang="en"
class="page"
>
<head>
<meta charset="UTF-8" />
<meta
name="viewport"
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:wght@400;500;700&display=swap"
rel="stylesheet"
/>

<link
rel="shortcut icon"
href="/src/images/star-active.svg"
type="image/x-icon"
/>

<link
rel="stylesheet"
href="./styles/index.scss"
/>
<link
rel="stylesheet"
href="./styles/index.scss"
/>
</head>
<body>
<h1>Product cards</h1>

<body class="page__body">
<div
class="product-card"
data-qa="card"
>
<div class="product-card__image">
<img
src="images/imac.jpeg"
alt="APPLE A1419 iMac 27"
/>
</div>

<div class="product-card__info">
<h3 class="product-card__title">
APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A)
</h3>
<p class="product-card__code">Product code: 195434</p>

<div class="product-card__reviews">
<div class="product-card__stars">
<div class="product-card__star"></div>
<div class="product-card__star"></div>
<div class="product-card__star"></div>
<div class="product-card__star"></div>
<div class="product-card__star"></div>
</div>
<span class="product-card__count">Reviews: 5</span>
</div>

<div class="product-card__price">
<span class="product-card__label">Price:</span>
<span class="product-card__value">$2,199</span>
</div>

<button
class="product-card__button product-card__button--hover"
data-qa="hover"
>
Buy
</button>
</div>
</div>
</body>
</html>
17 changes: 17 additions & 0 deletions src/styles/blocks/font.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.roboto-regular {
font-family: Roboto, sans-serif;
font-weight: 400;
font-style: normal;
}

.roboto-medium {
font-family: Roboto, sans-serif;
font-weight: 500;
font-style: normal;
}

.roboto-bold {
font-family: Roboto, sans-serif;
font-weight: 700;
font-style: normal;
}
13 changes: 13 additions & 0 deletions src/styles/blocks/page.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.page {
font-family: Roboto, Arial, sans-serif;
font-weight: 400;

&__body {
margin: 0;
height: 100vh;

display: flex;
align-items: center;
justify-content: center;
}
}
113 changes: 113 additions & 0 deletions src/styles/blocks/product-card.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
.product-card {
width: 200px;
height: 408px;
padding: 32px 16px 16px;

border-radius: 5px;
border: 1px solid rgba(243, 243, 243, 1);
box-sizing: border-box;

display: flex;
flex-direction: column;
justify-content: space-between;

&__image {
padding-inline: 3px;

& img {
width: 100%;
height: 134px;
}
}

&__title {
margin: 0;
font-family: inherit;
font-size: 12px;
font-weight: 500;
line-height: 18px;
color: $color-main;
}

&__code {
margin: 4px 0 16px;
font-family: inherit;
font-size: 10px;
line-height: 14px;
color: rgba(97, 96, 112, 1);
}

&__reviews {
display: flex;
justify-content: space-between;
}

&__stars {
display: flex;
}

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

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

&__count {
font-family: inherit;
font-weight: 400;
font-size: 10px;
line-height: 14px;
align-self: end;
color: $color-main;
}

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

&__label {
font-family: inherit;
font-size: 12px;
line-height: 18px;
color: rgba(97, 96, 112, 1);
}

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

&__button {
height: 40px;
width: 100%;
border: none;
border-radius: 5px;
background-color: $color-button;
cursor: pointer;

font-family: inherit;
font-weight: 700;
font-size: 14px;
line-height: 16px;
text-transform: uppercase;
color: rgba(255, 255, 255, 1);

&:hover {
background-color: #fff;
border: 1px solid $color-button;
color: $color-button;
}
}
}
16 changes: 16 additions & 0 deletions src/styles/blocks/stars.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.stars {
display: flex;

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

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

@import './utils/variables';
@import './blocks/font';
@import './blocks/page';
@import './blocks/product-card';
2 changes: 2 additions & 0 deletions src/styles/utils/variables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
$color-main: rgba(6, 11, 53, 1);
$color-button: rgba(0, 172, 220, 1);

0 comments on commit 4d31931

Please sign in to comment.