mirror of
https://github.com/vercel/commerce.git
synced 2025-08-14 21:01:23 +00:00
.github
.vscode
packages
site
assets
components
auth
cart
checkout
common
icons
product
ui
Button
Collapse
Container
Dropdown
ErrorMessage
Grid
Hero
Input
Link
LoadingDots
Logo
Marquee
Modal
Quantity
Rating
Rating.module.css
Rating.tsx
index.ts
Sidebar
Skeleton
Text
ThemeSwitcher
README.md
context.tsx
index.ts
wishlist
search.tsx
config
lib
pages
public
.env.template
.eslintrc
.gitignore
.npmrc
.prettierignore
.prettierrc
commerce-config.js
commerce.config.json
global.d.ts
next-env.d.ts
next.config.js
package.json
postcss.config.js
tailwind.config.js
tsconfig.json
.editorconfig
.gitignore
.prettierignore
.prettierrc
README.md
license.md
package-lock.json
package.json
pnpm-lock.yaml
pnpm-workspace.yaml
turbo.json
yarn.lock
26 lines
555 B
TypeScript
26 lines
555 B
TypeScript
import { FC, memo } from 'react'
|
|
import rangeMap from '@lib/range-map'
|
|
import { Star } from '@components/icons'
|
|
import cn from 'clsx'
|
|
|
|
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)
|