811131518e
* initial work on permissions * search dropdown permissions * permissions tab * added empty state * added new permssion detail route * added detail screen * fixed load * added decision strategy * added tests * fixed class name and identeded the expandable table row
38 lines
982 B
TypeScript
38 lines
982 B
TypeScript
import React from "react";
|
|
import { useTranslation } from "react-i18next";
|
|
import {
|
|
DescriptionListGroup,
|
|
DescriptionListTerm,
|
|
DescriptionListDescription,
|
|
} from "@patternfly/react-core";
|
|
|
|
type DetailDescriptionProps<T> = {
|
|
name: string;
|
|
array?: string[] | T[];
|
|
convert?: (obj: T) => string;
|
|
};
|
|
|
|
export function DetailDescription<T>({
|
|
name,
|
|
array,
|
|
convert,
|
|
}: DetailDescriptionProps<T>) {
|
|
const { t } = useTranslation("clients");
|
|
return (
|
|
<DescriptionListGroup>
|
|
<DescriptionListTerm>{t(name)}</DescriptionListTerm>
|
|
<DescriptionListDescription>
|
|
{array?.map((element) => {
|
|
const value =
|
|
typeof element === "string" ? element : convert!(element);
|
|
return (
|
|
<span key={value} className="pf-u-pr-sm">
|
|
{value}
|
|
</span>
|
|
);
|
|
})}
|
|
{array?.length === 0 && <i>{t("common:none")}</i>}
|
|
</DescriptionListDescription>
|
|
</DescriptionListGroup>
|
|
);
|
|
}
|