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

Create product card #5125

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
14 changes: 7 additions & 7 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ 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://anastat1on.github.io/layout_product-cards/)
- [TEST REPORT LINK](https://anastat1on.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)
47 changes: 46 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,53 @@
rel="stylesheet"
href="./styles/index.scss"
/>
<link
href="https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,200..1000;1,200..1000&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"
/>
</head>
<body>
<h1>Product cards</h1>
<div
class="card"
data-qa="card"
>
<div class="card__content">

Choose a reason for hiding this comment

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

This tag is redundant here, please remove it.

Choose a reason for hiding this comment

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

Suggested change
<div class="card__content">

<div class="card__item-image"></div>

Choose a reason for hiding this comment

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

use image tag to show imac picture.

Copy link
Author

Choose a reason for hiding this comment

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

thank you so much for review and suggestions, will fix it :)

<div class="card__item">

Choose a reason for hiding this comment

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

Suggested change
<div class="card__item">

Choose a reason for hiding this comment

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

This tag is redundant here, please remove it.

<div class="card__item-name">
APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A)
</div>
<div class="card__item-code">Product code: 195434</div>
Comment on lines +27 to +30

Choose a reason for hiding this comment

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

use semantic tags for text. Please make it for everywhere.

Suggested change
<div class="card__item-name">
APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A)
</div>
<div class="card__item-code">Product code: 195434</div>
<h3 class="card__item-name">
APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A)
</h3>
<pclass="card__item-code">Product code: 195434</p>

</div>
<div class="review">
<div class="review__star">
<div class="review__star-stars"></div>

<div class="review__star-stars"></div>

<div class="review__star-stars"></div>

<div class="review__star-stars"></div>

<div class="review__star-stars"></div>
</div>

<div class="review__comments">Reviews: 5</div>
</div>

<div class="price">
<div class="price__item">Price:</div>

<div class="price__amount">$2,199</div>
</div>

<div
class="buy"
data-qa="hover"
>
<a class="buy__button">Buy</a>
</div>
Comment on lines +54 to +59

Choose a reason for hiding this comment

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

Suggested change
<div
class="buy"
data-qa="hover"
>
<a class="buy__button">Buy</a>
</div>
<a class="buy__button">Buy</a>

Choose a reason for hiding this comment

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

Use a link without div cover tag

</div>
</div>
</body>
</html>
87 changes: 87 additions & 0 deletions src/styles/blocks/card.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
.card {
width: 200px;
height: 400px;
margin: 40px;

Choose a reason for hiding this comment

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

this margin is redundant here, please remove it


padding: 32px 19px 16px;

Choose a reason for hiding this comment

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

Suggested change
padding: 32px 19px 16px;
padding: 32px 16px 16px;


border: 1px solid rgb(214, 212, 212);
border-radius: 5px;
box-sizing: border-box;
align-items: center;

&__item-image {
background: no-repeat;
background-image: url(../images/imac.jpeg);
background-size: cover;

height: 134px;
}

&__content {
height: 100%;
width: 100%;

display: flex;
flex-direction: column;
justify-content: space-between;
}

&__item-name {
font-size: 12px;
font-weight: 500;
}

&__item-code {
margin-top: 4px;
font-size: 10px;
color: $light-color-text;
}
}

.review {
display: flex;
justify-content: space-between;

&__comments {
font-size: 10px;
line-height: 14px;
}
}

.price {
display: flex;
justify-content: space-between;

&__item {
color: $light-color-text;
font-size: 12px;
}

&__amount {
font-size: 16px;
font-weight: 700;
}
}

.buy {
height: 40px;
border-radius: 5px;

color: white;
text-transform: uppercase;

background: $buy-button-color;

font-size: 14px;
font-weight: 700;
text-align: center;
align-content: center;

&:hover {
border: 1px solid $buy-button-color;
background-color: white;
color: $buy-button-color;
box-sizing: border-box;
}
}
15 changes: 15 additions & 0 deletions src/styles/blocks/stars.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.review__star {
display: flex;

&-stars {
background-image: url(../images/star.svg);
background-repeat: no-repeat;
width: 16px;
height: 16px;
padding: 2px;
Comment on lines +4 to +9

Choose a reason for hiding this comment

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

Suggested change
&-stars {
background-image: url(../images/star.svg);
background-repeat: no-repeat;
width: 16px;
height: 16px;
padding: 2px;
&-stars {
background-image: url(../images/star.svg);
background-repeat: no-repeat;
background-position: center;
width: 16px;
height: 16px;
margin-right: 4px;

}

& .review__star-stars:nth-child(-n + 4) {
background-image: url(../images/star-active.svg);
}
}
8 changes: 8 additions & 0 deletions src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
@import './utils/variables';
@import './blocks/card';
@import './blocks/stars';

body {
margin: 0;

font-family: $main-font;
line-height: $main-line-height;
font-weight: $main-font-weight;
}
6 changes: 6 additions & 0 deletions src/styles/utils/variables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
$main-font: 'Roboto', 'Arial', sans-serif;
$main-color-text: rgba(6, 11, 53, 1);
$main-font-weight: 400;
$light-color-text: rgba(97, 96, 112, 1);
$buy-button-color: rgba(0, 172, 220, 1);
$main-line-height: 18px;
Loading