import React, { SVGProps } from 'react'; import { FiveStar } from './ratings/FiveStar'; import { FourHalfStar } from './ratings/FourHalfStar'; import { FourStar } from './ratings/FourStar'; import { OneHalfStar } from './ratings/OneHalfStar'; import { OneStar } from './ratings/OneStar'; import { ThreeHalfStar } from './ratings/ThreeHalfStar'; import { ThreeStar } from './ratings/ThreeStar'; import { TwoHalfStar } from './ratings/TwoHalfStar'; import { TwoStar } from './ratings/TwoStar'; import { ZeroStar } from './ratings/ZeroStar'; export type TrustPilotStarsProps = SVGProps & { rating?: 0 | 1 | 1.5 | 2 | 2.5 | 3 | 3.5 | 4 | 4.5 | 5; }; const trustPilotStarsLogoTitle = { 0: 'Trustpilot Zero stars rating', 1: 'Trustpilot One star', 1.5: 'Trustpilot One and a half stars rating', 2: 'Trustpilot Two stars rating', 2.5: 'Trustpilot Two and a half stars rating', 3: 'Trustpilot Three stars rating', 3.5: 'Trustpilot Three and a half stars rating', 4: 'Trustpilot Four stars rating', 4.5: 'Trustpilot Four and a half stars rating', 5: 'Trustpilot Five stars rating', } as const; const TrustPilotStars = ({ rating = 5, ...props }: TrustPilotStarsProps) => ( {trustPilotStarsLogoTitle[rating]} An illustration of the Trustpilot Stars Logo {rating === 0 && } {rating === 1 && } {rating === 1.5 && } {rating === 2 && } {rating === 2.5 && } {rating === 3 && } {rating === 3.5 && } {rating === 4 && } {rating === 4.5 && } {rating === 5 && } ); export default TrustPilotStars;