Skip to content

Commit

Permalink
add task solution
Browse files Browse the repository at this point in the history
  • Loading branch information
ErasoumZe committed Oct 23, 2024
1 parent 469a691 commit f1e176a
Show file tree
Hide file tree
Showing 6 changed files with 328 additions and 7 deletions.
8 changes: 4 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Product cards

Create a pages 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 pages 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,14 +16,14 @@ Create a pages with product card using `flexbox`, `BEM` and `SCSS` based on [thi
- Rewrite `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.

In this task, you can directly link *.scss files to HTML. This is possible because [we use the Parcel library](https://en.parceljs.org/scss.html) to bundle the source code.
In this task, you can directly link \*.scss files to HTML. This is possible because [we use the Parcel library](https://en.parceljs.org/scss.html) to bundle the source code.

## Checklist

❗️ 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://ErasoumZe.github.io/layout_product-cards/)
- [TEST REPORT LINK](https://ErasoumZe.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
52 changes: 50 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,60 @@
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,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&amp;display=swap"
rel="stylesheet"
/>
<link
rel="stylesheet"
href="./styles/index.scss"
href="./styles/index.css"
/>
</head>
<body>
<h1>Product cards</h1>
<div
class="card"
data-qa="card"
>
<img
class="image"
src="images/imac.jpeg"
alt="Product"
/>
<div class="product-name">
APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A)
</div>
<div class="product-code">Product code: 195434</div>
<div class="review">
<div class="review__stars">
<span class="review__stars-star"></span>
<span class="review__stars-star"></span>
<span class="review__stars-star"></span>
<span class="review__stars-star"></span>
<span class="review__stars-star"></span>
</div>
<span class="review__number">Reviews: 5</span>
</div>
<div class="price">
<span class="price__title">Price:</span>
<span class="price__cost">$2,199</span>
</div>
<div class="buy-button">
<a
href="#"
class="buy-button__link"
data-qa="hover"
>
BUY
</a>
</div>
</div>
</body>
</html>
4 changes: 3 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
'use strict';
import './styles/index.scss';

('use strict');
133 changes: 133 additions & 0 deletions src/styles/index.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions src/styles/index.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

128 changes: 128 additions & 0 deletions src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,131 @@
html {
font-family: Roboto, Arial, Helvetica, sans-serif;
}

body {
margin: 0;
}

.card {
box-sizing: border-box;
background-color: #fff;
border: 1px solid #f3f3f3;
border-radius: 5px;
flex-direction: column;
width: 200px;
display: flex;
}

.image {
width: 160px;
height: 134px;
margin: 32px auto 0;
display: flex;
}

.product-name {
color: #060b35;
padding-inline: 16px;
margin-top: 40px;
font-weight: 500;
font-size: 12px;
line-height: 18px;
display: flex;
}

.product-code {
color: #616070;
margin-top: 4px;
padding-left: 16px;
font-weight: 400;
font-size: 10px;
line-height: 14px;
display: flex;
}

.review {
justify-content: space-between;
align-items: flex-end;
margin-top: 16px;
padding-inline: 16px;
display: flex;
}

.review__stars {
align-items: center;
display: flex;
}

.review__stars-star {
background-image: url(/src/images/star.svg);
background-position: 50%;
background-repeat: no-repeat;
width: 16px;
height: 16px;
display: flex;
}

.review__stars-star:not(:last-child) {
margin-right: 4px;
}

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

.review__number {
color: #060b35;
font-weight: 400;
font-size: 10px;
line-height: 14px;
}

.price {
justify-content: space-between;
align-items: center;
margin-top: 24px;
padding-inline: 16px;
line-height: 18px;
display: flex;
}

.price__title {
color: #616070;
font-weight: 400;
font-size: 12px;
line-height: 18px;
}

.price__cost {
color: #060b35;
font-weight: 700;
font-size: 16px;
line-height: 18px;
}

.buy-button {
background-color: #00acdc;
border: 1px solid #00acdc;
border-radius: 5px;
align-items: center;
height: 39px;
margin: 16px;
display: flex;
}

.buy-button__link {
color: #fff;
margin: 0 auto;
font-size: 14px;
font-weight: 700;
line-height: 16px;
text-decoration: none;
}

.buy-button:hover {
background-color: #fff;
}

.buy-button:hover .buy-button__link {
color: #00acdc;
}

0 comments on commit f1e176a

Please sign in to comment.