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