import * as React from "react" import { cn } from "@/lib/utils" export type DescriptionListItem = { term: React.ReactNode description: React.ReactNode } export type DescriptionListProps = React.ComponentProps<"dl"> & { items?: DescriptionListItem[] columns?: 1 | 2 | 3 } function DescriptionList({ items, columns = 1, className, children, ...props }: DescriptionListProps) { return (
{items?.map((item, index) => ( {item.description} )) ?? children}
) } export type DescriptionListRowProps = React.ComponentProps<"div"> & { term: React.ReactNode } function DescriptionListRow({ term, className, children, ...props }: DescriptionListRowProps) { return (
{term}
{children}
) } export { DescriptionList, DescriptionListRow }