keycloak-scim/src/clients/initial-access/AccessTokenDialog.tsx

44 lines
957 B
TypeScript
Raw Normal View History

2021-03-04 08:20:37 +00:00
import { useTranslation } from "react-i18next";
import {
Alert,
AlertVariant,
ClipboardCopy,
Form,
FormGroup,
Modal,
ModalVariant,
} from "@patternfly/react-core";
type AccessTokenDialogProps = {
token: string;
toggleDialog: () => void;
};
export const AccessTokenDialog = ({
token,
toggleDialog,
}: AccessTokenDialogProps) => {
const { t } = useTranslation("clients");
return (
<Modal
title={t("initialAccessTokenDetails")}
isOpen={true}
onClose={toggleDialog}
variant={ModalVariant.medium}
>
<Alert
title={t("copyInitialAccessToken")}
isInline
variant={AlertVariant.warning}
/>
<Form className="pf-u-mt-md">
<FormGroup label={t("initialAccessToken")} fieldId="initialAccessToken">
<ClipboardCopy id="initialAccessToken" isReadOnly>
{token}
</ClipboardCopy>
</FormGroup>
</Form>
</Modal>
);
};