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 product card #5132

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://vsolodkyi-mate.github.io/layout_product-cards/)
- [TEST REPORT LINK](https://vsolodkyi-mate.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
51 changes: 50 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,57 @@
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.

Ensure that the SCSS file index.scss is correctly structured and organized as per the task requirements, with separate files for different BEM blocks.

/>
<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=Poppins&family=Roboto:wght@400;500;700&display=swap"
rel="stylesheet"
/>
</head>
<body>
<h1>Product cards</h1>
<div
data-qa="card"
class="card"
>
<img
src="./images/imac.jpeg"
alt="product iMAC"
class="card__image"
/>
<h1 class="card__title">
APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A)
</h1>
<p class="card__text">Product code: 195434</p>
<div class="allstars">

Choose a reason for hiding this comment

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

The class allstars does not follow the BEM naming convention. Consider renaming it to something like card__allstars to maintain consistency with the BEM methodology.

<div class="stars">
<div class="stars__star stars__star--active"></div>
<div class="stars__star stars__star--active"></div>
<div class="stars__star stars__star--active"></div>
<div class="stars__star stars__star--active"></div>
<div class="stars__star stars__star--active"></div>
</div>
<p class="allstars__text">Reviews: 5</p>

Choose a reason for hiding this comment

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

The class allstars__text should be nested under the allstars block if following BEM conventions. Ensure that the SCSS reflects this structure.

</div>
<div class="price">
<div class="price__text">Price:</div>
<div class="price__amount">$2,199</div>
</div>
<div class="buy">
<a
href="#"
data-qa="hover"
class="buy__button"
>
BUY
</a>
</div>
</div>
</body>
</html>
30 changes: 30 additions & 0 deletions src/styles/card.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.card {
background-color: #fff;
border: 1px solid #fff;
border-radius: 5px;
width: 200px;
padding: 0 16px 16px;

&__image {
width: 160px;
height: 134px;
margin: 32px auto 0;
display: flex;
}

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

&__text {
color: #616070;
margin: 4px 0 0;
font-size: 10px;
font-weight: 400;
line-height: 14px;
}
}
55 changes: 54 additions & 1 deletion src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,56 @@
body {
@import './variables';
@import './card';
@import './stars';

* {
margin: 0;
font-family: $font;
box-sizing: border-box;
}

.price {
justify-content: space-between;
align-items: center;
height: 18px;
margin: 24px 0 0;
display: flex;

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

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

.buy__button {
font-family: $font;
margin-top: 16px;
cursor: pointer;
text-align: center;
color: #fff;
text-transform: uppercase;
background-color: #00acdc;
border: none;
border-radius: 5px;
width: 100%;
height: 40px;
font-size: 14px;
font-weight: 700;
line-height: 40px;
text-decoration: none;
display: inline-block;
}

.buy__button:hover {
color: #00acdc;
background-color: #fff;
border: 1px solid #00acdc;
}
40 changes: 40 additions & 0 deletions src/styles/stars.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
.allstars {

Choose a reason for hiding this comment

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

The class allstars does not follow the BEM naming convention. Consider renaming it to something like stars__container to maintain consistency with the BEM methodology.

justify-content: space-between;
align-items: center;
height: 16px;
margin: 16px 0 0;
display: flex;

.stars {

Choose a reason for hiding this comment

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

The class stars should be a block, not an element under allstars. Ensure that the BEM structure is correctly implemented.

margin: 0;
padding: 0;
display: flex;

&__star {
background-repeat: no-repeat;
background-position: 50%;
width: 16px;
height: 16px;
margin-right: 4px;

&--active {
background-image: url(../images/star.svg);
}

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

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

&__text {

Choose a reason for hiding this comment

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

The class allstars__text should be nested under the correct BEM block. Ensure that the SCSS reflects this structure.

color: #060b35;
font-size: 10px;
font-weight: 400;
line-height: 14px;
}
}
1 change: 1 addition & 0 deletions src/styles/variables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$font: Roboto, serif;
Loading