import { forwardRef } from 'react'; import type { ComponentPropsWithoutRef, Key } from 'react'; import classNames from 'classnames'; import type { OmitUnion } from '@/mastodon/utils/types'; import { MiniCard } from '.'; import type { MiniCardProps as BaseCardProps } from '.'; import classes from './styles.module.css'; export type MiniCardProps = BaseCardProps & { key?: Key; }; interface MiniCardListProps { cards?: MiniCardProps[]; } export const MiniCardList = forwardRef< HTMLDListElement, OmitUnion, MiniCardListProps> >(({ cards = [], className, children, ...props }, ref) => { if (!cards.length) { return null; } return (
{cards.map((card, index) => ( ))} {children}
); }); MiniCardList.displayName = 'MiniCardList';