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

made product card #5050

Open
wants to merge 1 commit 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://Vekt00r.github.io/layout_product-cards/)
- [TEST REPORT LINK](https://Vekt00r.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)
45 changes: 44 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,51 @@
rel="stylesheet"
href="./styles/index.scss"
/>
<link
rel="preconnect"
href="https://fonts.googleapis.com"
/>
<link
rel="preconnect"
href="https://fonts.gstatic.com"
/>
<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__picture"
src="./images/imac.jpeg"
alt="iMac"
/>
<div class="card__title">
APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A)
</div>
<div class="card__product-code">Product code: 195434</div>
<div class="card__reviews">
<div class="stars">
<div class="stars__star-1"></div>
<div class="stars__star-2"></div>
<div class="stars__star-3"></div>
<div class="stars__star-4"></div>
<div class="stars__star-5"></div>
</div>
Reviews: 5
</div>
<div class="card__price">Price:</div>
<a
class="card__button"
href="#"
data-qa="hover"
>
BUY
</a>
</div>
</body>
</html>
84 changes: 84 additions & 0 deletions src/styles/card.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
@use './variables.scss' as *;
@use './fonts.scss' as *;

.card {
width: $card-width;
height: $card-height;
font-family: Roboto, sans-serif;

box-sizing: border-box;
padding: calc($margin-value * 2) $margin-value $margin-value;

background-color: $colors--white;
border: 1px solid $colors--gray-elements;
border-radius: $border-radius;

&__picture {
display: block;
margin: 0 auto calc($margin-value * 2.5);
width: 160px;
height: 134px;
}
&__title {
margin-bottom: calc($margin-value / 4);
font-size: 12px;
font-weight: 500;
line-height: 18px;
color: $colors--main-accent;
}
&__product-code {
margin-bottom: $margin-value;
font-size: 10px;
font-weight: 400;
line-height: 14px;
color: $colors--secondary;
}
&__reviews {
margin-bottom: calc($margin-value * 1.5);
display: flex;
justify-content: space-between;
align-items: flex-end;

font-size: 10px;
font-weight: 400;
line-height: 14px;
}
&__price {
margin-bottom: $margin-value;
display: flex;
justify-content: space-between;
font-size: 12px;
font-weight: 400;
line-height: 18px;
color: $colors--secondary;
&::after {
content: '$2,199';
font-size: 16px;
font-weight: 700;
color: $colors--main-accent;
}
}
&__button {
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;

color: $colors--white;
text-decoration: none;
font-size: 14px;
font-weight: 700;
line-height: 16px;

background-color: $colors--blue-accent;
border: none;
border-radius: $border-radius;
height: 40px;

&:hover {
background: none;
border: 1px solid $colors--blue-accent;
color: $colors--blue-accent;
}
}
}
19 changes: 19 additions & 0 deletions src/styles/fonts.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.roboto {
&-regular {
font-family: Roboto, serif;
font-weight: 400;
font-style: normal;
}

&-medium {
font-family: Roboto, serif;
font-weight: 500;
font-style: normal;
}

&-bold {
font-family: Roboto, serif;
font-weight: 700;
font-style: normal;
}
}
3 changes: 3 additions & 0 deletions src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
@use './card.scss';
@use './stars.scss';

body {
margin: 0;
}
27 changes: 27 additions & 0 deletions src/styles/stars.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
@use './variables.scss' as *;

.stars {
width: 96px;
display: flex;
flex-direction: row;
justify-content: space-between;

@for $index from 1 through 5 {
.stars__star-#{$index} {
width: 16px;
height: 16px;
background-repeat: no-repeat;
background-position: center;
}

@if $index <= 4 {
.stars__star-#{$index} {
background-image: url(../images/star-active.svg);
}
} @else {
.stars__star-#{$index} {
background-image: url(../images/star.svg);
}
}
}
}
9 changes: 9 additions & 0 deletions src/styles/variables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
$colors--main-accent: #060b35;
$colors--secondary: #616070;
$colors--white: #fff;
$colors--gray-elements: #f3f3f3;
$colors--blue-accent: #00acdc;
$card-width: 200px;
$card-height: 408px;
$border-radius: 5px;
$margin-value: 16px;
Loading