Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pterodactyl
GitHub Repository: pterodactyl/panel
Path: blob/1.0-develop/resources/scripts/components/elements/dialog/ConfirmationDialog.tsx
10260 views
1
import React from 'react';
2
import { Dialog, RenderDialogProps } from './';
3
import { Button } from '@/components/elements/button/index';
4
5
type ConfirmationProps = Omit<RenderDialogProps, 'description' | 'children'> & {
6
children: React.ReactNode;
7
confirm?: string | undefined;
8
onConfirmed: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
9
};
10
11
export default ({ confirm = 'Okay', children, onConfirmed, ...props }: ConfirmationProps) => {
12
return (
13
<Dialog {...props} description={typeof children === 'string' ? children : undefined}>
14
{typeof children !== 'string' && children}
15
<Dialog.Footer>
16
<Button.Text onClick={props.onClose}>Cancel</Button.Text>
17
<Button.Danger onClick={onConfirmed}>{confirm}</Button.Danger>
18
</Dialog.Footer>
19
</Dialog>
20
);
21
};
22
23