Last active
March 3, 2021 01:15
-
-
Save Inontran/5fec3835851aeea4ad38680a1e1d2e12 to your computer and use it in GitHub Desktop.
код рейтинга со звездочками
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="rate-star"> | |
| <div class="rate-star__stars-wrapper"> | |
| <input type="hidden" class="rate-star__input" value="3.5" readonly="" /> | |
| <span class="rate-star__star" data-number-star="5"></span> | |
| <span class="rate-star__star" data-number-star="4"></span> | |
| <span class="rate-star__star" data-number-star="3"></span> | |
| <span class="rate-star__star" data-number-star="2"></span> | |
| <span class="rate-star__star" data-number-star="1"></span> | |
| </div> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // RATE-STAR ------------ | |
| .rate-star{ | |
| display: inline-flex; | |
| .rate-star__stars-wrapper{ | |
| display: inline-flex; | |
| align-items: center; | |
| flex-direction: row-reverse; | |
| margin: 0 -5px; | |
| } | |
| .rate-star__star{ | |
| display: inline-block; | |
| width: calc_rem(15); | |
| height: calc_rem(15); | |
| background-image: url(#{$STYLE_PATH}images/icons/star-orange-o.svg); | |
| background-position: center; | |
| background-repeat: no-repeat; | |
| margin: 0 5px; | |
| text-decoration: none; | |
| border: 0; | |
| box-shadow: none; | |
| background-color: transparent; | |
| } | |
| @for $i from 0 through 5 { | |
| .rate-star__input{ | |
| // значение кратное 1 | |
| &[value^="#{$i}"]{ | |
| @for $j from 0 through $i{ | |
| & ~ .rate-star__star[data-number-star="#{$j}"]{ | |
| background-image: url(#{$STYLE_PATH}images/icons/star-orange.svg); | |
| } | |
| } | |
| } | |
| // значение кратное 0.5 | |
| &[value="#{$i}.5"]{ | |
| & ~ .rate-star__star[data-number-star="#{$i + 1}"]{ | |
| background-image: url(#{$STYLE_PATH}images/icons/star-orange-half-o.svg); | |
| } | |
| } | |
| } | |
| } | |
| .rate-star__input:not([readonly]) ~ .rate-star__star:hover{ | |
| &, | |
| & ~ .rate-star__star{ | |
| background-image: url(#{$STYLE_PATH}images/icons/star-orange.svg); | |
| } | |
| } | |
| } | |
| // RATE-STAR ------------ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg"> | |
| <path d="M3.48353 14.0063L6.79477 12.1747V2.50568L5.49245 5.28072L1 5.97138L4.25069 9.30159L3.48353 14.0063Z" fill="#FF5C00"/> | |
| <path d="M3.48353 14.0063L7.50138 11.7839L11.5192 14.0063L10.7521 9.30159L14.0028 5.97138L9.51031 5.28072L7.50138 1L5.49245 5.28072M3.48353 14.0063L4.25069 9.30159L1 5.97138L5.49245 5.28072M3.48353 14.0063L6.79477 12.1747V2.50568L5.49245 5.28072" stroke="#FF5C00" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> | |
| </svg> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment