Refactored some stuff
This commit is contained in:
committed by
fabioberger
parent
336adc6974
commit
e2b4670016
@@ -47,7 +47,7 @@ const LevelWrapper = styled.div`
|
||||
`;
|
||||
|
||||
const DifficultyLabel = styled.span`
|
||||
font-size: 0.777777778rem;
|
||||
font-size: 0.78rem;
|
||||
color: ${colors.brandDark};
|
||||
margin-right: 0.611111111rem;
|
||||
margin-right: 0.61rem;
|
||||
`;
|
||||
|
||||
@@ -12,17 +12,13 @@ interface IRatingBulletProps {
|
||||
}
|
||||
|
||||
export const RatingBar: React.FC<IRatingBarProps> = ({ rating }) => {
|
||||
const id = Math.random()
|
||||
.toString(36)
|
||||
.substring(2, 15);
|
||||
const ratingPlaceholders = Array.from(new Array(3), (value, index) => index + 1);
|
||||
const ratingPlaceholders = Array.from(new Array(3), (_, index) => index + 1);
|
||||
const fillCheck = (currentIndex: number) => currentIndex <= rating;
|
||||
|
||||
// TODO convert this to use a Container component
|
||||
return (
|
||||
<RatingBarWrapper>
|
||||
{ratingPlaceholders.map((currentIndex: number) => (
|
||||
<RatingBullet key={`${id}-${currentIndex}`} isFilled={fillCheck(currentIndex)} />
|
||||
<RatingBullet key={`rating-${currentIndex}`} isFilled={fillCheck(currentIndex)} />
|
||||
))}
|
||||
</RatingBarWrapper>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user