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

test solution #5040

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 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://KrawczykDamiann.github.io/layout_product-cards/)
- [TEST REPORT LINK](https://KrawczykDamiann.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)
61 changes: 60 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
<!doctype html>
<html lang="en">
<head>
<link
rel="preconnect"
href="https://fonts.googleapis.com"
/>
<link
rel="preconnect"
href="https://fonts.gstatic.com"
crossorigin="use-credentials"
/>
<link
rel="preconnect"
href="https://fonts.googleapis.com"
/>
<link
rel="preconnect"
href="https://fonts.gstatic.com"
crossorigin="use-credentials"
/>
Comment on lines +13 to +21

Choose a reason for hiding this comment

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

There are duplicate preconnect links for 'https://fonts.googleapis.com' and 'https://fonts.gstatic.com'. It's redundant to have multiple preconnect links for the same URL, as it can lead to unnecessary network requests. Consider removing the duplicates to optimize performance.

<link
href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap"
rel="stylesheet"
/>
<meta charset="UTF-8" />
<meta
name="viewport"
Expand All @@ -13,6 +35,43 @@
/>
</head>
<body>
<h1>Product cards</h1>
<div
class="card"
data-qa="card"
>
<img
class="card__image"
src="./images/imac.jpeg"
alt="Product"
/>

<div class="card__title">
<div class="card__title-text">
APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A)
</div>
<div class="card__title-product-code">Product code: 195434</div>
</div>
<div class="card__stars">
<div class="card__stars-star"></div>
<div class="card__stars-star"></div>
<div class="card__stars-star"></div>
<div class="card__stars-star"></div>
<div class="card__stars-star"></div>
<div class="card__stars-reviews">Reviews: 5</div>
</div>

Choose a reason for hiding this comment

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

if you have separate file stars then you should have stars block and you need container for star elements so you could use space-between

Suggested change
</div>
<div class="card__stars">
<div class="card__stars-star"></div>
<div class="card__stars-star"></div>
<div class="card__stars-star"></div>
<div class="card__stars-star"></div>
<div class="card__stars-star"></div>
<div class="card__stars-reviews">Reviews: 5</div>
</div>
</div>
<div class="card__stars stars">
<div class="stars__list">
<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>
<div class="stars__reviews">Reviews: 5</div>
</div>


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

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__price">
<div class="card__price-text">Price:</div>
<div class="card__price-sum">$2,199</div>
</div>
<div class="card__price price">
<div class="price__text">Price:</div>
<div class="price__sum">$2,199</div>
</div>


<a
class="card__button"
href="#"
data-qa="hover"
>

Choose a reason for hiding this comment

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

Suggested change
<a
class="card__button"
href="#"
data-qa="hover"
>
<a
class="card__button button"
href="#"
data-qa="hover"
>

buy
</a>
</div>
</body>
</html>
23 changes: 23 additions & 0 deletions src/styles/_button.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.card__button {

Choose a reason for hiding this comment

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

Suggested change
.card__button {
.button {

@include center;
@include roboto700;

height: 40px;
width: $primary-width;
margin-top: 15px;

Choose a reason for hiding this comment

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

Suggested change
width: $primary-width;
margin-top: 15px;
width: 100%;
margin-top: 16px;

border-radius: 5px;
border-color: transparent;
KrawczykDamiann marked this conversation as resolved.
Show resolved Hide resolved
text-decoration: none;
cursor: pointer;
font-size: 14px;
line-height: 16px;
text-transform: uppercase;
color: #fff;
background-color: #00acdc;

KrawczykDamiann marked this conversation as resolved.
Show resolved Hide resolved
&:hover {
background-color: #fff;
border: 1px solid #00acdc;
color: #00acdc;
}
}
38 changes: 38 additions & 0 deletions src/styles/_card.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
.card {
@include center;

padding: 16px;
border: 1px solid #f3f3f3;
border-radius: 5px;
flex-direction: column;

KrawczykDamiann marked this conversation as resolved.
Show resolved Hide resolved
&__image {
margin-top: 16px;
width: 160px;
height: 134px;
background-image: url('../images/imac.jpeg');

Choose a reason for hiding this comment

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

Suggested change
background-image: url('../images/imac.jpeg');

}

&__title {
margin-top: 40px;

&-text {
@include roboto500;

width: 166px;
display: flex;

Choose a reason for hiding this comment

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

Suggested change
width: 166px;
display: flex;

font-size: 12px;
line-height: 18px;
color: #060b35;
}

&-product-code {
@include roboto400;

color: #616070;
font-size: 10px;
line-height: 14px;
margin-top: 4px;
}
}
}
23 changes: 23 additions & 0 deletions src/styles/_mixins.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@mixin center {
display: flex;
align-items: center;
justify-content: center;
}

@mixin roboto400 {
font-family: Roboto, serif;
font-weight: 400;
font-style: normal;
}

@mixin roboto500 {
font-family: Roboto, serif;
font-weight: 500;
font-style: normal;
}

@mixin roboto700 {
font-family: Roboto, serif;
font-weight: 700;
font-style: normal;
}
20 changes: 20 additions & 0 deletions src/styles/_price.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.card__price {

Choose a reason for hiding this comment

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

Suggested change
.card__price {
.price {

display: flex;
justify-content: space-between;
align-items: center;
margin-top: 22px;
width: 166px;

Choose a reason for hiding this comment

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

Suggested change
margin-top: 22px;
width: 166px;
margin-top: 24px;
width: 100%;


&-text {

Choose a reason for hiding this comment

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

Suggested change
&-text {
&__text {

@include roboto400;

color: #616070;
font-size: 12px;
}

&-sum {

Choose a reason for hiding this comment

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

Suggested change
&-sum {
&__sum {

@include roboto700;

Choose a reason for hiding this comment

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

Suggested change
color: #060b35;
line-height: 18px;

font-size: 16px;
}
}
27 changes: 27 additions & 0 deletions src/styles/_stars.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.card__stars {
@include center;

line-height: 14px;
width: 100%;
margin-top: 17px;

Choose a reason for hiding this comment

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

Suggested change
.card__stars {
@include center;
line-height: 14px;
width: 100%;
margin-top: 17px;
.stars {
line-height: 14px;
width: 100%;
margin-top: 16px;
display: flex;
justify-content: space-between;
align-items: flex-end;
&__list {
@include center;
}

Choose a reason for hiding this comment

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

Suggested change
margin-top: 17px;
margin-top: 16px;
display: flex;
justify-content: space-between;
align-items: flex-end;
&__list {
@include center;
}


&-star {
KrawczykDamiann marked this conversation as resolved.
Show resolved Hide resolved
width: 16px;
height: 16px;
margin-right: 4px;
background-image: url('../images/star-active.svg');
background-repeat: no-repeat;
}

&-star:nth-child(n + 5) {

Choose a reason for hiding this comment

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

Suggested change
&-star:nth-child(n + 5) {
&__star:nth-child(n + 5) {

background-image: url('../images/star.svg');
}

&-reviews {
@include roboto400;

margin-left: 16px;
KrawczykDamiann marked this conversation as resolved.
Show resolved Hide resolved
color: #060b35;
font-size: 10px;
}
}
1 change: 1 addition & 0 deletions src/styles/_variables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$primary-width: 166px;

Choose a reason for hiding this comment

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

create variables for colors

Suggested change
$primary-width: 166px;

131 changes: 131 additions & 0 deletions src/styles/index.css

Choose a reason for hiding this comment

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

you don't need this file

Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
.card {
display: flex;
align-items: center;
justify-content: center;
padding: 16px;
border: 1px solid #f3f3f3;
border-radius: 5px;
flex-direction: column;
}

.card__image {
margin-top: 16px;
width: 160px;
height: 134px;
background-image: url('../images/imac.jpeg');
}

.card__title {
margin-top: 40px;
}

.card__title-text {
font-family: Roboto, serif;
font-weight: 500;
font-style: normal;
width: 166px;
display: flex;
font-size: 12px;
line-height: 18px;
color: #060b35;
}

.card__title-product-code {
font-family: Roboto, serif;
font-weight: 400;
font-style: normal;
color: #616070;
font-size: 10px;
line-height: 14px;
margin-top: 4px;
}

.card__stars {
display: flex;
align-items: center;
justify-content: center;
line-height: 14px;
width: 100%;
margin-top: 17px;
}

.card__stars-star {
width: 16px;
height: 16px;
margin-right: 4px;
background-image: url('../images/star-active.svg');
background-repeat: no-repeat;
}

.card__stars-star:nth-child(n + 5) {
background-image: url('../images/star.svg');
}

.card__stars-reviews {
font-family: Roboto, serif;
font-weight: 400;
font-style: normal;
margin-left: 16px;
color: #060b35;
font-size: 10px;
}

.card__price {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 22px;
width: 166px;
}

.card__price-text {
font-family: Roboto, serif;
font-weight: 400;
font-style: normal;
color: #616070;
font-size: 12px;
}

.card__price-sum {
font-family: Roboto, serif;
font-weight: 700;
font-style: normal;
font-size: 16px;
}

.card__button {
display: flex;
align-items: center;
justify-content: center;
font-family: Roboto, serif;
font-weight: 700;
font-style: normal;
height: 40px;
width: 166px;
margin-top: 15px;
border-radius: 5px;
border-color: transparent;
text-decoration: none;
cursor: pointer;
font-size: 14px;
line-height: 16px;
text-transform: uppercase;
color: #fff;
background-color: #00acdc;
}

.card__button:hover {
background-color: #fff;
border: 1px solid #00acdc;
color: #00acdc;
}

body {
display: flex;
align-items: center;
justify-content: center;
font-family: Roboto, serif;
font-weight: 400;
font-style: normal;
margin: 0;
} /*# sourceMappingURL=index.css.map */
1 change: 1 addition & 0 deletions src/styles/index.css.map
KrawczykDamiann marked this conversation as resolved.
Show resolved Hide resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
@import './mixins';
@import './variables';
@import './card';
@import './stars';
@import './price';
@import './button';

body {
@include center;

Choose a reason for hiding this comment

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

Suggested change
@include center;

@include roboto400;

margin: 0;
}
Loading