mirror of
https://github.com/vercel/commerce.git
synced 2025-03-16 23:42:32 +00:00
* Added Next.js eslint * added eslint to lint-staged * Added eslint config for prettier * Fixed eslint issues in multiple files * Fixed error in linter
26 lines
561 B
TypeScript
26 lines
561 B
TypeScript
import { FC, memo } from 'react'
|
|
import rangeMap from '@lib/range-map'
|
|
import { Star } from '@components/icons'
|
|
import cn from 'classnames'
|
|
|
|
export interface RatingProps {
|
|
value: number
|
|
}
|
|
|
|
const Quantity: FC<RatingProps> = ({ value = 5 }) => (
|
|
<div className="flex flex-row py-6 text-accent-9">
|
|
{rangeMap(5, (i) => (
|
|
<span
|
|
key={`star_${i}`}
|
|
className={cn('inline-block ml-1 ', {
|
|
'text-accent-5': i >= Math.floor(value),
|
|
})}
|
|
>
|
|
<Star />
|
|
</span>
|
|
))}
|
|
</div>
|
|
)
|
|
|
|
export default memo(Quantity)
|