Spaces:
Configuration error
Configuration error
Download src/components/common/ConfirmationForm.tsx from SreejithSHR/umami: direct link, hf CLI and curl.
- Browser
- Download file 1.03 kB
-
https://huggingface.co/spaces/SreejithSHR/umami/resolve/main/src/components/common/ConfirmationForm.tsx
- Command line
-
hf download hf://spaces/SreejithSHR/umami/src/components/common/ConfirmationForm.tsx
-
curl -L -o ConfirmationForm.tsx https://huggingface.co/spaces/SreejithSHR/umami/resolve/main/src/components/common/ConfirmationForm.tsx
1.03 kB
| import { ReactNode } from 'react'; | |
| import { Button, LoadingButton, Form, FormButtons } from 'react-basics'; | |
| import { useMessages } from 'components/hooks'; | |
| export interface ConfirmationFormProps { | |
| message: ReactNode; | |
| buttonLabel?: ReactNode; | |
| buttonVariant?: 'none' | 'primary' | 'secondary' | 'quiet' | 'danger'; | |
| isLoading?: boolean; | |
| error?: string | Error; | |
| onConfirm?: () => void; | |
| onClose?: () => void; | |
| } | |
| export function ConfirmationForm({ | |
| message, | |
| buttonLabel, | |
| buttonVariant, | |
| isLoading, | |
| error, | |
| onConfirm, | |
| onClose, | |
| }: ConfirmationFormProps) { | |
| const { formatMessage, labels } = useMessages(); | |
| return ( | |
| <Form error={error}> | |
| <p>{message}</p> | |
| <FormButtons flex> | |
| <LoadingButton isLoading={isLoading} onClick={onConfirm} variant={buttonVariant}> | |
| {buttonLabel || formatMessage(labels.ok)} | |
| </LoadingButton> | |
| <Button onClick={onClose}>{formatMessage(labels.cancel)}</Button> | |
| </FormButtons> | |
| </Form> | |
| ); | |
| } | |
| export default ConfirmationForm; | |