Files
pterodactyl-panel/resources/scripts/components/elements/ConfirmationModal.tsx
T

35 lines
1.1 KiB
TypeScript
Raw Normal View History

2020-03-22 19:10:49 -07:00
import React from 'react';
import Modal, { RequiredModalProps } from '@/components/elements/Modal';
2020-07-04 15:05:44 -07:00
import tw from 'twin.macro';
import Button from '@/components/elements/Button';
2020-03-22 19:10:49 -07:00
type Props = {
2020-03-22 19:10:49 -07:00
title: string;
buttonText: string;
children: string;
onConfirmed: () => void;
showSpinnerOverlay?: boolean;
} & RequiredModalProps;
2020-03-22 19:10:49 -07:00
const ConfirmationModal = ({ title, appear, children, visible, buttonText, onConfirmed, showSpinnerOverlay, onDismissed }: Props) => (
2020-03-22 19:10:49 -07:00
<Modal
appear={appear || true}
2020-03-22 19:10:49 -07:00
visible={visible}
showSpinnerOverlay={showSpinnerOverlay}
onDismissed={() => onDismissed()}
2020-03-22 19:10:49 -07:00
>
2020-07-04 17:00:19 -07:00
<h2 css={tw`text-2xl mb-6`}>{title}</h2>
2020-07-04 15:05:44 -07:00
<p css={tw`text-sm`}>{children}</p>
<div css={tw`flex items-center justify-end mt-8`}>
<Button isSecondary onClick={() => onDismissed()}>
2020-03-22 19:10:49 -07:00
Cancel
2020-07-04 15:05:44 -07:00
</Button>
<Button color={'red'} css={tw`ml-4`} onClick={() => onConfirmed()}>
2020-03-22 19:10:49 -07:00
{buttonText}
2020-07-04 15:05:44 -07:00
</Button>
2020-03-22 19:10:49 -07:00
</div>
</Modal>
);
export default ConfirmationModal;