Skip to content

Commit

Permalink
improve semantic
Browse files Browse the repository at this point in the history
  • Loading branch information
nataliia2211 committed Oct 17, 2024
1 parent 83107ee commit 8b7babc
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 140 deletions.
49 changes: 20 additions & 29 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,53 +29,44 @@
<!-- # end region -->

<body>
<div
class="product-card"
<article
class="card"
data-qa="card"
>
<img
src="images/imac.jpeg"
alt="Computer"
class="product-card__image"
class="card__image"
/>
<h1 class="product-card__items product-card__items--title">
APPLE A1419 iMac 27" Retina
<br />
5K Monoblock (MNED2UA/A)
</h1>
<p class="card__title">
APPLE A1419 iMac 27" Retina 5K Monoblock (MNED2UA/A)
</p>
<p class="card__product">Product code: 195434</p>
<div class="card__reviews">
<div class="reviews-stars">
<div class="stars-aitem"></div>

<h2 class="product-card__items product-card__items--product-code">
Product code: 195434
</h2>
<div class="stars-aitem"></div>

<div class="product-card__items product-card__items--reviews">
<div class="product-card__items-stars">
<div class="product-card__items-stars-star"></div>
<div class="stars-aitem"></div>

<div class="product-card__items-stars-star"></div>
<div class="stars-aitem"></div>

<div class="product-card__items-stars-star"></div>

<div class="product-card__items-stars-star"></div>

<div
class="product-card__items-stars-star product-card__items-stars-star--not-active"
></div>
<div class="stars-aitem stars-aitem--not-active"></div>
</div>
<h2 class="product-card__items-review">Reviews: 5</h2>
<p class="reviews-text">Reviews: 5</p>
</div>

<div class="product-card__items product-card__items--price">
<h2 class="product-card__price product-card__price--letters">Price:</h2>
<h2 class="product-card__price product-card__price--numbers">$2,199</h2>
<div class="card__price">
<p class="card__price-title">Price:</p>
<p class="card__price-value">$2,199</p>
</div>
<a
href="#"
class="product-card__items product-card__items--link"
class="card__link"
data-qa="hover"
>
Buy
</a>
</div>
</article>
</body>
</html>
102 changes: 0 additions & 102 deletions src/styles/body.scss

This file was deleted.

94 changes: 94 additions & 0 deletions src/styles/card.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
$cardWidth: 200px;
$blueColor: $blueColor;

.card {
display: flex;
flex-direction: column;
align-items: center;
width: $cardWidth;
border: 1px solid #f3f3f3;
padding: 32px 16px 16px;

&__image {
width: 160px;
}

&__title {
width: 100%;
font-size: 12px;
font-weight: 500;
line-height: 18px;
text-align: center;
margin-top: 40px;
margin-bottom: 0;
}

&__product {
font-size: 10px;
font-weight: 400;
line-height: 14px;
margin-top: 4px;
width: 100%;
}

&__reviews {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 16px;
height: 14px;
width: 100%;
}

&__price {
display: flex;
justify-content: space-between;
align-items: center;
height: 18px;
line-height: 18px;
margin-top: 24px;
width: 100%;

&-title {
font-size: 12px;
font-weight: 400;
line-height: 18px;
}

&-value {
font-size: 16px;
font-weight: 700;
line-height: 18px;
}
}

&__link {
display: block;
justify-content: center;
background-color: $blueColor;
height: 40px;
border-radius: 5px;
font-size: 14px;
font-weight: 700;
line-height: 40px;
text-align: center;
text-transform: uppercase;
text-decoration: none;
color: #f3f3f3;
margin-top: 16px;
width: 100%;

&:hover {
background-color: #f3f3f3;
color: $blueColor;
border: 1px solid $blueColor;
border-radius: 5px;
}
}
}

.reviews-text {
font-size: 10px;
font-weight: 400;
line-height: 14px;
}
8 changes: 7 additions & 1 deletion src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
@import 'body';
@import 'card';
@import 'stars';

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

html {
font-family: Roboto, sans-serif;
}

body {
margin: 0;
}
16 changes: 8 additions & 8 deletions src/styles/stars.scss
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
.product-card__items-stars {
.reviews-stars {
display: flex;
}

.product-card__items-stars-star {
.stars-aitem {
display: flex;
background-image: url(../images/star-active.svg);
background-repeat: no-repeat;
background-position: center;
width: 16px;
height: 16px;
}

.product-card__items-stars-star:not(:last-child) {
margin-right: 4px;
}
&:not(:last-child) {
margin-right: 4px;
}

.product-card__items-stars-star--not-active {
background-image: url(../images/star.svg);
&--not-active {
background-image: url(../images/star.svg);
}
}

0 comments on commit 8b7babc

Please sign in to comment.