Skip to content

Commit

Permalink
Solution
Browse files Browse the repository at this point in the history
  • Loading branch information
fromjkeee16 committed Jan 5, 2025
1 parent 606dc21 commit f53ddaf
Show file tree
Hide file tree
Showing 7 changed files with 187 additions and 16 deletions.
18 changes: 9 additions & 9 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Product cards

Create a page with product card using `flexbox`, `BEM` and `SCSS` based on [this mockup](https://www.figma.com/file/ojkArVazq7vsX0nbpn9CxZ/Moyo-%2F-Catalog-(ENG)?node-id=11325%3A2287&mode=dev).
Create a page with product card using `flexbox`, `BEM` and `SCSS` based on [this mockup](<https://www.figma.com/file/ojkArVazq7vsX0nbpn9CxZ/Moyo-%2F-Catalog-(ENG)?node-id=11325%3A2287&mode=dev>).

> Here are the [Layout Tasks Instructions](https://mate-academy.github.io/layout_task-guideline)
Expand All @@ -16,20 +16,20 @@ Create a page with product card using `flexbox`, `BEM` and `SCSS` based on [this
- Rewrite the `stars` block from the [Stars task](https://github.com/mate-academy/layout_stars) with SCSS and use it
- Find the required font on [google fonts](https://fonts.google.com/) and use.

*Important note*: In this task, you are allowed to link `*.scss` files directly in HTML `<link>` tags using `href` attribute.
_Important note_: In this task, you are allowed to link `*.scss` files directly in HTML `<link>` tags using `href` attribute.
This is possible because [we use the Parcel library](https://en.parceljs.org/scss.html) to bundle your solution's source code.

## Checklist

❗️ 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://fromjkeee16.github.io/layout_product-cards/)
- [TEST REPORT LINK](https://fromjkeee16.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)
64 changes: 60 additions & 4 deletions src/index.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,74 @@
<!-- #region HEAD -->
<!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>
<title>card 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>
<!-- #endregion -->
<body class="page__body">
<div
class="card"
data-qa="card"
>
<div class="card__banner">
<img
src="./images/imac.jpeg"
class="card__photo"
alt="Apple iMac card photo"
/>
</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__rating">
<div class="stars stars--4">
<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__number-reviews">Reviews: 5</div>
</div>
<div class="card__price">
<div class="card__price-label">Price:</div>
<div class="card__price-number">$2,199</div>
</div>
<div class="card__buy-button">
<a
href="#"
class="card__button-element"
data-qa="hover"
>
Buy
</a>
</div>
</div>
</body>
</html>
86 changes: 86 additions & 0 deletions src/styles/blocks/card.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
.card {
padding: 32px 16px 16px;
width: 200px;

box-sizing: border-box;
border: 1px solid #f3f3f3;
border-radius: 5px;

&__banner {
margin-bottom: 40px;
}

&__photo {
height: 134px;
width: 160px;
display: block;
margin: 0 auto;
}

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

&__code {
font-weight: 400;
font-size: 10px;
line-height: 14px;
color: $secondary-color;
margin-bottom: 16px;
}

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

&__number-reviews {
line-height: 14px;
font-size: 10px;
font-weight: 400;
}

&__price {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16px;
line-height: $primary-lineheight;

&-label {
font-size: 12px;
color: $secondary-color;
}

&-number {
font-weight: bold;
font-size: 16px;
}
}

&__button-element {
display: block;
height: 40px;
border-radius: 5px;
box-sizing: border-box;

color: white;
font-weight: bold;
text-align: center;
align-content: center;
text-transform: uppercase;
text-decoration: none;
background-color: $blue-accent-color;
border: 1px solid $blue-accent-color;

&:hover {
color: $blue-accent-color;
background-color: white;
cursor: pointer;
}
}
}
5 changes: 5 additions & 0 deletions src/styles/blocks/page.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.page__body {
margin: 0;
font-family: Roboto, serif;
color: $main-color;
}
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 {
height: $stars-size;
width: $stars-size;
margin-right: 4px;
background-repeat: no-repeat;
background-position: center;
background-image: url('../images/star.svg');
}

&--4 &__star:nth-child(-n + 4) {
background-image: url('../images/star-active.svg');
}
}
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 './utils/variables';
@import './blocks/page';
@import './blocks/card';
@import './blocks/stars';
7 changes: 7 additions & 0 deletions src/styles/utils/variables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
$blue-accent-color: #00acdc;
$main-color: #060b35;
$secondary-color: #616070;
$card-width: 200px;
$primary-lineheight: 18px;
$secondary-lineheight: 14px;
$stars-size: 16px;

0 comments on commit f53ddaf

Please sign in to comment.