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

Solution | layout-stars #3757

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 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
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ Follow

❗️ Replace `<your_account>` with your Github username and copy the links to `Pull Request` description:

- [DEMO LINK](https://<your_account>.github.io/layout_stars/)
- [TEST REPORT LINK](https://<your_account>.github.io/layout_stars/report/html_report/)
- [DEMO LINK](https://Reyti.github.io/layout_stars/)

Choose a reason for hiding this comment

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

please check your deployment since DEMO link leads to readme.md and TEST link leads to 404 page

- [TEST REPORT LINK](https://Reyti.github.io/layout_stars/report/html_report/)

❗️ Copy this `Checklist` to the `Pull Request` description after links, and put `- [x]` before each point after you checked it.

Expand Down
48 changes: 47 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,52 @@
<link rel="stylesheet" href="./style.css">
</head>
<body>
<h1>Stars</h1>
<ul class="stars stars--0">
<li class="stars__star"></li>
<li class="stars__star"></li>
<li class="stars__star"></li>
<li class="stars__star"></li>
<li class="stars__star"></li>
</ul>

<ul class="stars stars--1">
<li class="stars__star"></li>
<li class="stars__star"></li>
<li class="stars__star"></li>
<li class="stars__star"></li>
<li class="stars__star"></li>
</ul>

<ul class="stars stars--2">
<li class="stars__star"></li>
<li class="stars__star"></li>
<li class="stars__star"></li>
<li class="stars__star"></li>
<li class="stars__star"></li>
</ul>

<ul class="stars stars--3">
<li class="stars__star"></li>
<li class="stars__star"></li>
<li class="stars__star"></li>
<li class="stars__star"></li>
<li class="stars__star"></li>
</ul>

<ul class="stars stars--4">
<li class="stars__star"></li>
<li class="stars__star"></li>
<li class="stars__star"></li>
<li class="stars__star"></li>
<li class="stars__star"></li>
</ul>

<ul class="stars stars--5">
<li class="stars__star"></li>
<li class="stars__star"></li>
<li class="stars__star"></li>
<li class="stars__star"></li>
<li class="stars__star"></li>
</ul>
</body>
</html>
43 changes: 43 additions & 0 deletions src/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
* {

Choose a reason for hiding this comment

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

it's not a good practice to reset styles using * selector

margin: 0;
padding: 0;
}

.stars {
display: flex;
list-style: none;
}

.stars__star {
margin: 0 2px;

Choose a reason for hiding this comment

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

use :not(:last-child) to set margin-right to each star besides last one

margin-top: 2px;

Choose a reason for hiding this comment

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

redundant

Suggested change
margin-top: 2px;

width: 16px;
height: 14px;

Choose a reason for hiding this comment

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

should have the same width and height

background-image: url("images/star.svg");
background-size: auto;
background-repeat: no-repeat;
}

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

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

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

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

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

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

Choose a reason for hiding this comment

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

use as a list

Suggested change
.stars--0 .stars__star:nth-child(n):not(:nth-child(n+1)) {
background-image: url("images/star-active.svg");
}
.stars--1 .stars__star:nth-child(n):not(:nth-child(n+2)) {
background-image: url("images/star-active.svg");
}
.stars--2 .stars__star:nth-child(n):not(:nth-child(n+3)) {
background-image: url("images/star-active.svg");
}
.stars--3 .stars__star:nth-child(n):not(:nth-child(n+4)) {
background-image: url("images/star-active.svg");
}
.stars--4 .stars__star:nth-child(n):not(:nth-child(n+5)) {
background-image: url("images/star-active.svg");
}
.stars--5 .stars__star:nth-child(n):not(:nth-child(n+6)) {
background-image: url("images/star-active.svg");
}
.stars--0 .stars__star:nth-child(n):not(:nth-child(n+1)),
.stars--1 .stars__star:nth-child(n):not(:nth-child(n+2)),
.stars--2 .stars__star:nth-child(n):not(:nth-child(n+3)),
.stars--3 .stars__star:nth-child(n):not(:nth-child(n+4)),
.stars--4 .stars__star:nth-child(n):not(:nth-child(n+5)),
.stars--5 .stars__star:nth-child(n):not(:nth-child(n+6)) {
background-image: url("images/star-active.svg");
}

Loading