mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-01-16 22:16:49 +01:00
16 lines
481 B
TypeScript
16 lines
481 B
TypeScript
import type { DialogProps } from '../components/core/Dialog';
|
|
import { useDialog } from '../components/DialogContext';
|
|
import type { AlertProps } from './Alert';
|
|
import { Alert } from './Alert';
|
|
|
|
export function useAlert() {
|
|
const dialog = useDialog();
|
|
return ({ title, body }: { title: DialogProps['title']; body: AlertProps['body'] }) =>
|
|
dialog.show({
|
|
title,
|
|
hideX: true,
|
|
size: 'sm',
|
|
render: ({ hide }) => Alert({ onHide: hide, body }),
|
|
});
|
|
}
|