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

Develop #5117

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Develop #5117

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
18 changes: 9 additions & 9 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Product cards

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

*Important note*: In this task, you are allowed to link `*.scss` files directly in HTML `<link>` tags using `href` attribute.
_Important note_: In this task, you are allowed to link `*.scss` files directly in HTML `<link>` tags using `href` attribute.
This is possible because [we use the Parcel library](https://en.parceljs.org/scss.html) to bundle your solution's source code.

## Checklist

❗️ 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://cementix.github.io/layout_product-cards/)
- [TEST REPORT LINK](https://cementix.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)
53 changes: 52 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,59 @@
rel="stylesheet"
href="./styles/index.scss"
/>
<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:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&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"
>
<img
class="card__image"
src="./images/imac.jpeg"
alt="product image"
/>

<p class="card__title">
APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A)
</p>
<span class="card__code">Product code: 195434</span>

<div class="card__reviews">
<div class="stars stars--4 card__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="card__reviews-count">Reviews: 5</p>
</div>

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

<a
href="#"
class="card__button"
data-qa="hover"
>
BUY
</a>
</div>
</body>
</html>
102 changes: 102 additions & 0 deletions src/styles/blocks/card.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
@use '../utils/variables.scss';

.card {
width: 200px;
height: 408px;
padding: 32px 16px 16px;
border: 1px solid white;
border-radius: 5px;
display: flex;
flex-direction: column;
align-items: center;
text-align: left;

&__image {
width: 160px;
height: 134px;
margin-bottom: 40px;
}

&__title {
font-weight: 500;
font-size: 12px;
line-height: 18px;
color: variables.$main-accent;

Choose a reason for hiding this comment

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

There is an issue with the SCSS variable usage here. The correct syntax for using a variable in SCSS is variables.$variable-name. Ensure that the variables.scss file contains the $main-accent variable and that it is imported correctly.

margin-bottom: 4px;
}

&__code {
width: 100%;
font-weight: 400;
font-size: 10px;
line-height: 14px;
color: variables.$secondary-accent;

Choose a reason for hiding this comment

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

There is an issue with the SCSS variable usage here. The correct syntax for using a variable in SCSS is variables.$variable-name. Ensure that the variables.scss file contains the $secondary-accent variable and that it is imported correctly.

margin-bottom: 16px;
}

&__reviews {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 24px;
}

&__stars {
margin-right: 17px;
}

&__reviews-count {
font-weight: 400;
font-size: 10px;
line-height: 14px;
text-align: right;
color: variables.$main-accent;

Choose a reason for hiding this comment

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

There is an issue with the SCSS variable usage here. The correct syntax for using a variable in SCSS is variables.$variable-name. Ensure that the variables.scss file contains the $main-accent variable and that it is imported correctly.

}

&__price {
width: 100%;
display: flex;
justify-content: space-between;

&-text {
font-weight: 400;
font-size: 12px;
line-height: 18px;
color: variables.$secondary-accent;

Choose a reason for hiding this comment

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

There is an issue with the SCSS variable usage here. The correct syntax for using a variable in SCSS is variables.$variable-name. Ensure that the variables.scss file contains the $secondary-accent variable and that it is imported correctly.

}

&-value {
font-weight: 700;
font-size: 16px;
line-height: 18px;
text-align: right;
color: variables.$main-accent;

Choose a reason for hiding this comment

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

There is an issue with the SCSS variable usage here. The correct syntax for using a variable in SCSS is variables.$variable-name. Ensure that the variables.scss file contains the $main-accent variable and that it is imported correctly.

}

margin-bottom: 16px;
}

&__button {
width: 166px;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
font-weight: 700;
color: white;
font-size: 14px;
line-height: 16px;
text-align: center;
border: none;
border-radius: 5px;
text-decoration: none;
background-color: variables.$blue-accent;

Choose a reason for hiding this comment

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

There is an issue with the SCSS variable usage here. The correct syntax for using a variable in SCSS is variables.$variable-name. Ensure that the variables.scss file contains the $blue-accent variable and that it is imported correctly.


&:hover {
background-color: white;
color: variables.$blue-accent;

Choose a reason for hiding this comment

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

There is an issue with the SCSS variable usage here. The correct syntax for using a variable in SCSS is variables.$blue-accent. Ensure that the variables.scss file contains the $blue-accent variable and that it is imported correctly.

border: 1px solid variables.$blue-accent;

Choose a reason for hiding this comment

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

There is an issue with the SCSS variable usage here. The correct syntax for using a variable in SCSS is variables.$blue-accent. Ensure that the variables.scss file contains the $blue-accent variable and that it is imported correctly.

}
}
}
24 changes: 24 additions & 0 deletions src/styles/blocks/stars.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@use '../utils/variables.scss';

.stars {
display: flex;

&__star {
width: 16px;
height: 16px;
background-image: url('../images/star.svg');
background-repeat: no-repeat;
background-position: center;
margin-right: 4px;

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

@for $i from 1 through 5 {
&--#{$i} .stars__star:nth-child(-n + #{$i}) {
background-image: url('../images/star-active.svg');
}
}
}
12 changes: 11 additions & 1 deletion src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
body {
@import './utils/variables';
@import './blocks/card';
@import './blocks/stars';

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

body {
font-family: Roboto, serif;
}
3 changes: 3 additions & 0 deletions src/styles/utils/variables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
$main-accent: #060b35;
$secondary-accent: #616070;
$blue-accent: #00acdc;
Loading