1
0
mirror of https://github.com/vercel/commerce.git synced 2025-09-01 21:40:14 +00:00
Files
.vscode
assets
components
auth
cart
checkout
common
icons
product
ui
Button
Collapse
Container
Grid
Hero
Input
Link
LoadingDots
Logo
Marquee
Modal
Quantity
Rating
Rating.module.css
Rating.tsx
index.ts
Sidebar
Skeleton
Text
README.md
context.tsx
index.ts
wishlist
search.tsx
config
framework
lib
pages
public
.editorconfig
.env.template
.gitignore
.prettierignore
.prettierrc
README.md
codegen.bigcommerce.json
codegen.json
commerce.config.json
global.d.ts
license.md
next-env.d.ts
next.config.js
package-lock.json
package.json
postcss.config.js
swell-js.d.ts
tailwind.config.js
tsconfig.js
tsconfig.json
yarn.lock
commerce/components/ui/Rating/Rating.tsx
2021-06-08 11:31:48 -03:00

28 lines
613 B
TypeScript

import React, { FC } from 'react'
import rangeMap from '@lib/range-map'
import { Star } from '@components/icons'
import cn from 'classnames'
export interface RatingProps {
value: number
}
const Quantity: React.FC<RatingProps> = React.memo(({ value = 5 }) => {
return (
<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 Quantity