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

add task solution #5077

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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://wiltonmartinsdev.github.io/layout_product-cards/)
- [TEST REPORT LINK](https://wiltonmartinsdev.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
55 changes: 53 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,64 @@
name="viewport"
content="width=device-width, initial-scale=1.0"
/>
<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;1,100;1,300;1,400;1,500;1,700&display=swap"
rel="stylesheet"
/>
<title>Product cards</title>
<link
rel="stylesheet"
href="./styles/index.scss"
href="../src/styles/index.scss"
/>
</head>
<body>
<h1>Product cards</h1>
<div
class="product-card"
data-qa="card"
>
<div class="product-card__image-container">
<img
src="./images/imac.jpeg"
alt="imac"
class="product-card__image"
/>
</div>
<h1 class="product-card__title">
APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A)
</h1>
<h2 class="product-card__code">Product code: 195434</h2>

<div class="product-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>
<p class="product-card__reviews-text">Reviews: 5</p>
</div>

<div class="product-card__price">
<p class="product-card__price-label">Price:</p>
<p class="product-card__price-value">$2,199</p>
</div>
<button
type="button"
class="product-card__buy-button"
data-qa="hover"
>
BUY
</button>
</div>
</body>
</html>
11 changes: 11 additions & 0 deletions src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
@import 'variables';
@import 'product-card';
@import 'stars';

Choose a reason for hiding this comment

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

Missing declare:

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the tip, I'll make the adjustments

body {
margin: 0;
padding: 0;
box-sizing: border-box;

color: $main-accent-color;

font-family: Roboto, sans-serif;
font-size: 16px;
}
109 changes: 109 additions & 0 deletions src/styles/product-card.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
.product-card {
max-width: 200px;
min-height: 408px;

padding: 32px 16px 16px;

background-color: #fff;
color: $main-accent-color;

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

&__image-container {
display: flex;
justify-content: center;
width: 100%;
}

&__image {
width: 160px;
height: 134px;

margin-bottom: 30px;
}

&__title {
font-size: 12px;
font-weight: 500;
line-height: 18px;
text-align: left;

color: $main-accent-color;
}

&__code {
color: $secondary-color;

font-size: 10px;
font-weight: 400;
line-height: 14px;
text-align: left;
}

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

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

&__reviews-text {
font-size: 10px;

color: $main-accent-color;

margin-left: 8px;
}

&__price-label {
font-size: 12px;
line-height: 18px;
font-weight: 400;

color: $secondary-color;
}

&__price-value {
font-size: 16px;
line-height: 18px;

font-weight: 700;

color: $main-accent-color;
}

&__buy-button {
width: 100%;
height: 40px;

border-radius: 5px;
border: none;

background: $blue-accent-color;
color: #fff;

margin-top: 8px;
padding: 8px 16px;

font-size: 14px;
line-height: 16px;
font-weight: 700;
text-decoration: none;
text-transform: uppercase;

cursor: pointer;

&:hover {
background-color: #fff;
color: $blue-accent-color;

border: 1px solid $blue-accent-color;
}
}
}
26 changes: 26 additions & 0 deletions src/styles/stars.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.stars {
display: flex;
align-items: center;
justify-content: space-around;

height: 16px;
width: 96px;

&__star {
width: 13px;
height: 12px;
margin-right: 5px;
background-image: url(../images/star.svg);
background-repeat: no-repeat;
background-position: center;
background-size: contain;

&:last-child {
margin-right: 0;
}

&:nth-child(-n + 4) {
background-image: url(../images/star-active.svg);
}
}
}
3 changes: 3 additions & 0 deletions src/styles/variables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
$main-accent-color: #060b35;
$secondary-color: #616070;
$blue-accent-color: #00acdc;
Loading