keycloak-scim/src/clients/credentials/ClientSecret.tsx

35 lines
822 B
TypeScript
Raw Normal View History

import React from "react";
import { useTranslation } from "react-i18next";
import {
Button,
ClipboardCopy,
FormGroup,
Split,
SplitItem,
} from "@patternfly/react-core";
export type ClientSecretProps = {
secret: string;
toggle: () => void;
};
export const ClientSecret = ({ secret, toggle }: ClientSecretProps) => {
const { t } = useTranslation("clients");
return (
<FormGroup label={t("clientSecret")} fieldId="kc-client-secret">
<Split hasGutter>
<SplitItem isFilled>
<ClipboardCopy id="kc-client-secret" isReadOnly>
{secret}
</ClipboardCopy>
</SplitItem>
<SplitItem>
<Button variant="secondary" onClick={toggle}>
{t("regenerate")}
</Button>
</SplitItem>
</Split>
</FormGroup>
);
};