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

Solution #5031

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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://bombadilx.github.io/layout_product-cards/)
- [TEST REPORT LINK](https://bombadilx.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
46 changes: 45 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,52 @@
rel="stylesheet"
href="./styles/index.scss"

Choose a reason for hiding this comment

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

The href attribute should point to a .css file instead of a .scss file. Ensure that the SCSS is compiled to CSS and update the link accordingly.

/>
<link
href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap"
rel="stylesheet"
/>
</head>
<body>
<h1>Product cards</h1>
<div
class="card"
data-qa="card"
>
<img
class="card__img"
src="images/imac.jpeg"
alt="imac"
/>

<h3 class="card__title">
APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A)
</h3>

<span class="card__product-code">Product code: 195434</span>

<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>

<span class="card__reviews-count">Reviews: 5</span>
</div>

<div class="card__price">
<span class="card__price-text">Price:</span>
<span class="card__price-value">$2,199</span>
</div>

<a
data-qa="hover"
class="card__buy-link"
href="#"
>
BUY
</a>
</div>
</body>
</html>
94 changes: 94 additions & 0 deletions src/styles/card.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
.card {
max-width: 200px;
min-height: 408px;
background-color: #fff;

Choose a reason for hiding this comment

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

Consider using SCSS variables for the background color (#fff) to improve maintainability. Define a variable in a separate SCSS file and import it here.

border: 1px solid #f3f3f3;

Choose a reason for hiding this comment

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

The border color (#f3f3f3) should be defined as an SCSS variable. This will make it easier to update the color scheme in the future.

border-radius: 5px;
padding: 32px 16px 16px;
display: flex;
flex-direction: column;

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

&__title {
font-weight: 500;
font-size: 12px;
line-height: 18px;
color: #060b35;

Choose a reason for hiding this comment

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

The color (#060b35) is used multiple times. Consider defining it as an SCSS variable for consistency and easier maintenance.

margin-top: 40px;
margin-bottom: 4px;
}

&__product-code {
font-weight: 400;
font-size: 10px;
line-height: 14px;
color: #616070;

Choose a reason for hiding this comment

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

The color (#616070) should be defined as an SCSS variable. This will help maintain consistency across the styles.

}

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

&__reviews-count {
font-weight: 400;
font-size: 10px;
line-height: 14px;
color: #060b35;
margin: 0;
}

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

&__price-text {
font-weight: 400;
font-size: 12px;
line-height: 18px;
color: #616070;
margin: 0;
}

&__price-value {
font-weight: 700;
font-size: 16px;
line-height: 18px;
color: #060b35;
margin: 0;
}

&__buy-link {
font-weight: 700;
font-size: 14px;
width: 100%;
height: 40px;
margin: 0;
color: #fff;
background-color: #00acdc;
Comment on lines +79 to +80

Choose a reason for hiding this comment

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

The color (#00acdc) is used in multiple places. Define it as an SCSS variable to ensure consistency and ease of updates.

border-radius: 5px;
display: flex;
justify-content: center;
align-items: center;
text-transform: uppercase;
text-decoration: none;

&:hover {
color: #00acdc;
background-color: #fff;
border: 1px solid #00acdc;
}
}
}
7 changes: 6 additions & 1 deletion src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
body {
@use './card';
@use './stars';

Comment on lines +1 to +2

Choose a reason for hiding this comment

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

Consider importing a separate SCSS file for variables to ensure that all main values are consistent and easily maintainable across different style files.

* {
font-family: Roboto, sans-serif;
box-sizing: border-box;
margin: 0;
}
21 changes: 21 additions & 0 deletions src/styles/stars.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.stars {
display: flex;
flex-direction: row;

&__star {
width: 16px;
height: 16px;
Comment on lines +6 to +7

Choose a reason for hiding this comment

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

Consider defining SCSS variables for the width and height (16px) to ensure consistency and ease of updates.

margin-right: 4px;
background-image: url(../images/star.svg);

Choose a reason for hiding this comment

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

The image path (../images/star.svg) could be defined as an SCSS variable for better maintainability, especially if the path changes or is used in multiple places.

background-repeat: no-repeat;
background-position: center;

&:last-child {
margin: 0;
}

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

Choose a reason for hiding this comment

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

Similarly, consider defining a variable for the active star image path (../images/star-active.svg) to maintain consistency and ease of updates.

}
}
}
Loading