Skip to content
Open

Stars #6597

Show file tree
Hide file tree
Changes from 1 commit
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://<NazarKoval1212>.github.io/layout_stars/)
- [TEST REPORT LINK](https://<NazarKoval1212>.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
60 changes: 58 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- #region head -->
<!doctype html>
<html lang="en">
<head>
Expand All @@ -12,7 +13,62 @@
href="./style.css"
/>
</head>
<body>
<h1>Stars</h1>

<!-- #endregion -->

<body>
<div class="stars stars--0">

<a class ="stars__star"> </a>

Choose a reason for hiding this comment

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

The formatting of attributes is inconsistent throughout the file. For example, there are extra spaces around the = in class attributes (e.g., class ="..."). The standard convention is to have no spaces, like class="...". Please correct this for all similar occurrences in the file.


<a class ="stars__star"> </a>

<a class ="stars__star"> </a>

<a class ="stars__star" > </a>

<a class ="stars__star"> </a>

</div>

<div class="stars stars--1" >
<a class = "stars__star"></a>
<a class = "stars__star"></a>
<a class = "stars__star"></a>
<a class = "stars__star"></a>
<a class = "stars__star"></a>
</div>

<div class="stars stars--2">
<a class ="stars__star" ></a>
<a class ="stars__star" ></a>
<a class ="stars__star" ></a>
<a class ="stars__star" ></a>
<a class ="stars__star" ></a>
</div>

<div class="stars stars--3">
<a class ="stars__star" ></a>
<a class ="stars__star" ></a>
<a class ="stars__star" ></a>
<a class ="stars__star" ></a>
<a class ="stars__star" ></a>
</div>

<div class="stars stars--4">
<a class ="stars__star"></a>
<a class ="stars__star"></a>
<a class ="stars__star"></a>
<a class ="stars__star"></a>
<a class ="stars__star"></a>
</div>

<div class="stars stars--5">
<a class ="stars__star"></a>
<a class ="stars__star"></a>
<a class ="stars__star"></a>
<a class ="stars__star"></a>
<a class ="stars__star"></a>
</div>
</body>
</html>
42 changes: 41 additions & 1 deletion src/style.css
Original file line number Diff line number Diff line change
@@ -1 +1,41 @@
/* add styles here */
.stars__star{
width: 20px;
height: 20px;
background-image:url(images/star.svg);
background-size:
contain;
Comment on lines +9 to +10

Choose a reason for hiding this comment

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

It's standard practice to keep a CSS property and its value on the same line for better readability, like background-size: contain;.

background-repeat: no-repeat;
background-position: center;
}
Comment on lines +5 to +14

Choose a reason for hiding this comment

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

The task requires setting the distance between stars based on the Figma design. Currently, the stars will have no space between them. Consider adding a margin-right to the star elements and using a pseudo-class like :last-child to remove it from the final star in each group.


.stars{

Choose a reason for hiding this comment

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

The task requires resetting the browser's default margins. This is typically done with a rule for the body element (e.g., body { margin: 0; }) at the start of your stylesheet.

display: flex;
margin: 0;
}

.stars_star_active{
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.

This class .stars_star_active is not used in the HTML and should be removed. The active star state is already correctly handled by the .stars--N modifier classes and the :nth-child selector. Additionally, the class name does not follow BEM naming conventions.



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

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


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