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

add task solution #5017

Open
wants to merge 2 commits 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
6 changes: 3 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Implement the [Stars Block](https://www.figma.com/file/ojkArVazq7vsX0nbpn9CxZ/Moyo-%2F-Catalog-(ENG)?node-id=11325%3A2960) used in a card and catalog.

Hold `Alt` key (`Option` on MacOS) to measure distances in Figma.
Hold `Alt` key (`Option` on MacOS) to measure distances in Figma.

> Here are the [Layout Tasks Instructions](https://mate-academy.github.io/layout_task-guideline)

Expand All @@ -22,8 +22,8 @@ Hold `Alt` key (`Option` on MacOS) to measure distances in Figma.

❗️ 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://Stanislav0909.github.io/layout_stars/)
- [TEST REPORT LINK](https://Stanislav0909.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
29 changes: 27 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,35 @@
<title>Stars</title>
<link
rel="stylesheet"
href="./style.css"
href="style.css"
/>
</head>
<body>
<h1>Stars</h1>
<section class="stars">
<div class="stars stars--0">
<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>
<div class="stars stars--1">
<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>
<div class="stars stars--2">
<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>
<div class="stars stars--3">
<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>
<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>
<div class="stars stars--5">
<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>
</section>
</body>
</html>
27 changes: 26 additions & 1 deletion src/style.css
Original file line number Diff line number Diff line change
@@ -1 +1,26 @@
/* add styles here */

body, html, section {
margin: 0;
padding: 0;
}

.stars {
display: flex;
}

.stars__star {
width: 20px;
height: 20px;
background-image: url('./images/star.svg');
background-size: cover;
margin-right: 5px;
}

.stars--0 .stars__star:nth-child(-n+0),
.stars--1 .stars__star:nth-child(-n+1),
.stars--2 .stars__star:nth-child(-n+2),
.stars--3 .stars__star:nth-child(-n+3),
.stars--4 .stars__star:nth-child(-n+4),
.stars--5 .stars__star:nth-child(-n+5) {
background-image: url('./images/star-active.svg');
Comment on lines +19 to +24

Choose a reason for hiding this comment

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

The :nth-child selectors are incorrectly configured. For example, .stars--0 .stars__star:nth-child(-n+0) will not select any elements because -n+0 results in no valid index. Similarly, .stars--1 .stars__star:nth-child(-n+1) will only select the first child. Consider adjusting these selectors to correctly reflect the intended number of active stars. For instance, .stars--1 .stars__star:nth-child(-n+1) should be .stars--1 .stars__star:nth-child(-n+2) to select the first two stars.

Comment on lines +19 to +24

Choose a reason for hiding this comment

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

The nth-child selectors are using a pattern -n+X where X is the number of stars to be styled. However, the pattern -n+0 in line 17 will not select any elements, which might not be the intended behavior. You might want to adjust this to ensure it selects the correct number of stars.

Comment on lines +19 to +24

Choose a reason for hiding this comment

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

There is a logical error in the ':nth-child' selectors. The '-n+0' selector in '.stars--0 .stars__star:nth-child(-n+0)' will not select any elements, as it effectively means 'select none'. Similarly, the other selectors should be adjusted to correctly select the intended number of active stars. For example, '.stars--1 .stars__star:nth-child(-n+1)' should be '.stars--1 .stars__star:nth-child(-n+2)' to select the first star, and so on.

}
Loading