import { DescriptionListDescription, DescriptionListGroup, DescriptionListTerm, } from "@patternfly/react-core"; import { useTranslation } from "react-i18next"; import { Link, Path } from "react-router-dom"; type DetailDescriptionProps = { name: string; array?: string[] | T[]; convert?: (obj: T) => string; }; export function DetailDescription(props: DetailDescriptionProps) { return ; } type DetailDescriptionLinkProps = DetailDescriptionProps & { link?: (element: T) => Partial; }; export function DetailDescriptionLink({ name, array, convert, link, }: DetailDescriptionLinkProps) { const { t } = useTranslation(); return ( {t(name)} {array?.map((element) => { const value = typeof element === "string" ? element : convert!(element); return link ? ( {value} ) : ( {value} ); })} {array?.length === 0 && {t("none")}} ); }