Refactored some stuff

This commit is contained in:
Piotr Janosz
2019-07-19 14:38:36 +02:00
committed by fabioberger
parent 336adc6974
commit e2b4670016
2 changed files with 4 additions and 8 deletions

View File

@@ -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;
`;

View File

@@ -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>
);