Skip to content

Commit

Permalink
add task solution fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mgucma committed Oct 19, 2024
1 parent b023f6b commit e5afd3e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 22 deletions.
5 changes: 5 additions & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,39 @@
<div class="stars__star"></div>
<div class="stars__star"></div>
</div>

<div class="stars stars--1">
<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 stars--2">
<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 stars--3">
<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 stars--4">
<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 stars--5">
<div class="stars__star"></div>
<div class="stars__star"></div>
Expand Down
34 changes: 12 additions & 22 deletions src/style.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
/* add styles here */
* {
/* Zamiast selektora uniwersalnego * użyjemy stylowania dla elementów body */
body {
margin: 0;
padding: 0;
}

/* Ustawienie dla bloków z gwiazdkami */
.stars {
display: flex;
}

/* Ustawienia dla pojedynczej gwiazdki */
.stars__star {
background-image: url(./images/star.svg);
background-position: center;
Expand All @@ -15,30 +18,17 @@
width: 16px;
}

/* Dodanie odstępu między gwiazdkami, ale tylko od drugiej gwiazdki */
.stars__star:not(:first-child) {
margin-left: 4px;
}

.stars--0 .stars__star:nth-last-child(n + 6) {
background-image: url(./images/star-active.svg);
}

.stars--1 .stars__star:nth-last-child(n + 5) {
background-image: url(./images/star-active.svg);
}

.stars--2 .stars__star:nth-last-child(n + 4) {
background-image: url(./images/star-active.svg);
}

.stars--3 .stars__star:nth-last-child(n + 3) {
background-image: url(./images/star-active.svg);
}

.stars--4 .stars__star:nth-last-child(n + 2) {
background-image: url(./images/star-active.svg);
}

/* Aktywne gwiazdki - różne dla poszczególnych bloków z klasą stars--N */
.stars--0 .stars__star:nth-last-child(n + 6),
.stars--1 .stars__star:nth-last-child(n + 5),
.stars--2 .stars__star:nth-last-child(n + 4),
.stars--3 .stars__star:nth-last-child(n + 3),
.stars--4 .stars__star:nth-last-child(n + 2),
.stars--5 .stars__star:nth-last-child(n + 1) {
background-image: url(./images/star-active.svg);
}

0 comments on commit e5afd3e

Please sign in to comment.