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 #5105

Closed
wants to merge 2 commits into from
Closed

develop #5105

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://manuilenkoart.github.io/layout_product-cards/)
- [TEST REPORT LINK](https://manuilenkoart.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 @@ -7,12 +7,63 @@
content="width=device-width, initial-scale=1.0"
/>
<title>Product cards</title>
<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=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"
/>
<link
rel="stylesheet"
href="./styles/index.scss"
/>
</head>
<body>
<h1>Product cards</h1>
<section
class="card"
data-qa="card"
>
<img
class="card__image"
src="/src/images/imac.jpeg"
alt="desktop"
/>
<h2 class="card__title">
APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A)
</h2>

<p class="card__code">Product code: 195434</p>

<div class="card__review">
<div class="stars stars--4">
<span class="stars__star"></span>
<span class="stars__star"></span>
<span class="stars__star"></span>
<span class="stars__star"></span>
<span class="stars__star"></span>
</div>

<p class="card__count">Reviews: 5</p>
</div>

<div class="card__price">
<p class="card__description">Price:</p>
<p class="card__value">$2,199</p>
</div>

<button
class="card__button"
data-qa="hover"
>
buy
</button>
</section>
</body>
</html>
85 changes: 85 additions & 0 deletions src/styles/card.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
@import './variables';

.card {
box-sizing: border-box;
border: 1px solid #f3f3f3;
width: 200px;
padding: 32px 16px 16px;
font-family: Roboto, sans-serif;

&__image {
width: 160px;
height: 134px;
display: block;
margin: auto auto 40px;
}

&__title {
color: $color-main;
margin-bottom: 4px;
font-size: 12px;
font-weight: 500;
line-height: 18px;
}

&__code {
font-size: 10px;
font-weight: 400;
line-height: 14px;
color: $color-secondary;
margin-bottom: 16px;
}

&__review {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 24px;
}

&__count {
font-size: 10px;
font-weight: 400;
line-height: 14px;
color: $color-main;
}

&__price {
display: flex;
justify-content: space-between;
margin-bottom: 16px;
}

&__description {
font-size: 12px;
font-weight: 400;
line-height: 18px;
color: $color-secondary;
}

&__value {
font-size: 16px;
font-weight: 700;
line-height: 18px;
color: $color-main;
}

&__button {
width: 100%;
text-transform: uppercase;
background-color: $blue-accent;
color: #fff;
border-radius: 5px;
padding: 12px 0;
border: 1px solid $blue-accent;
font-size: 14px;
font-weight: 700;

&:hover {
color: $blue-accent;
background-color: #fff;

cursor: pointer;
}
}
}
7 changes: 6 additions & 1 deletion src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
body {
@import './stars';
@import './card';

body,
h2,
p {
margin: 0;
}
18 changes: 18 additions & 0 deletions src/styles/stars.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.stars {
display: flex;

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

@for $activeStar from 1 through 4 {
&__star:nth-child(-n + #{$activeStar}) {
background-image: url('../images/star-active.svg');
}
}
}
3 changes: 3 additions & 0 deletions src/styles/variables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
$color-main: #060b35;
$color-secondary: #616070;
$blue-accent: #00acdc;
Loading