diff --git a/components/product/ProductView/ProductView.tsx b/components/product/ProductView/ProductView.tsx index 50b84eb69..1a8b71d8f 100644 --- a/components/product/ProductView/ProductView.tsx +++ b/components/product/ProductView/ProductView.tsx @@ -9,11 +9,11 @@ import { getVariant, SelectedOptions } from '../helpers' import { Swatch, ProductSlider } from '@components/product' import { Button, Container, Text, useUI } from '@components/ui' import { useAddItem } from '@framework/cart' +import Rating from '@components/ui/Rating' import Collapse from '@components/ui/Collapse' import ProductCard from '@components/product/ProductCard' import WishlistButton from '@components/wishlist/WishlistButton' -import rangeMap from '@lib/range-map' -import { Star } from '@components/icons' + interface Props { children?: any product: Product @@ -154,19 +154,7 @@ const ProductView: FC = ({ product, relatedProducts }) => {
- {/** - * TODO make component Rate stars={} - */} -
- {rangeMap(4, (i) => ( - - - - ))} - - - -
+
36 reviews
diff --git a/components/ui/Rating/Rating.module.css b/components/ui/Rating/Rating.module.css new file mode 100644 index 000000000..e69de29bb diff --git a/components/ui/Rating/Rating.tsx b/components/ui/Rating/Rating.tsx new file mode 100644 index 000000000..c115006de --- /dev/null +++ b/components/ui/Rating/Rating.tsx @@ -0,0 +1,26 @@ +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: FC = ({ value = 5 }) => { + return ( +
+ {rangeMap(5, (i) => ( + = Math.floor(value), + })} + > + + + ))} +
+ ) +} + +export default Quantity diff --git a/components/ui/Rating/index.ts b/components/ui/Rating/index.ts new file mode 100644 index 000000000..1354efb25 --- /dev/null +++ b/components/ui/Rating/index.ts @@ -0,0 +1,2 @@ +export { default } from './Rating' +export * from './Rating' diff --git a/components/ui/index.ts b/components/ui/index.ts index ae5ebac25..47bdbd9ff 100644 --- a/components/ui/index.ts +++ b/components/ui/index.ts @@ -12,4 +12,5 @@ export { default as Text } from './Text' export { default as Input } from './Input' export { default as Collapse } from './Collapse' export { default as Quantity } from './Quantity' +export { default as Rating } from './Rating' export { useUI } from './context'