import React from "react"; 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({ name, array, convert, }: DetailDescriptionProps) { const { t } = useTranslation("clients"); return ( {t(name)} {array?.map((element) => { const value = typeof element === "string" ? element : convert!(element); return ( {value} ); })} {array?.length === 0 && {t("common:none")}} ); }