import { useMemo } from "react"; import "./rds-comp-reviews.scss"; import { ReviewStyleCard } from "./rds-comp-review-styles"; import Grid from "@mui/material/Grid"; import Box from "@mui/material/Box"; export { type Item, VariantType, RevieweStyle } from "./rds-comp-reviews-types"; import { type Item, VariantType, RevieweStyle } from "./rds-comp-reviews-types"; export interface RdsCompReviewsProps { itemList: Item[]; style?: RevieweStyle; variantType?: VariantType; } const GRID_SIZE = { xs: 12, sm: 12, md: 4, lg: 6, xl: 6, } as const; const getItemKey = (item: Item, index: number): string => item.username ?? item.name ?? `review-${index}`; const RdsCompReviews = ({ itemList, style, variantType = VariantType.Default, }: RdsCompReviewsProps) => { const showDefaultVariant = variantType === VariantType.Default; const gridItems = useMemo( () => itemList.map((item, index) => ({ key: getItemKey(item, index), content: , })), [itemList, style] ); return ( {showDefaultVariant && ( {gridItems.map(({ key, content }) => ( {content} ))} )} ); }; RdsCompReviews.displayName = "RdsCompReviews"; export default RdsCompReviews;