import * as React from 'react' ; import { FaRegStar , FaStarHalfAlt , FaStar } from 'react-icons/fa' ; import { ReactFCNoChildren } from 'YesterTech/types' ; import 'YesterTech/StarRatings.scss' ; export interface StarRatingsProps { rating : number ; } const StarRatings = ( { rating } ) : React . ReactElement => { let stars = [ ] ; for ( let i = 0 ; i < Math . floor ( rating ) ; i ++ ) { stars . push ( < FaStar key = { `star-${ i }` } />); } if ( rating % 1 > 0 ) stars . push ( < FaStarHalfAlt key = { `star-half` } />); while ( stars . length < 5 ) stars . push ( < FaRegStar key = { `star-empty-${ stars . length }` } />); return < span className = "star-ratings" > { stars } < /span>; } ; export default StarRatings ;