Commit d1046cb7 authored by Lyza Danger Gardner's avatar Lyza Danger Gardner Committed by Lyza Gardner

Use updated shared `Modal` instead of `ConfirmModal` in prompts

parent 332a32b5
import { render } from 'preact'; import { render } from 'preact';
import type { ComponentChildren } from 'preact';
import { ConfirmModal } from '@hypothesis/frontend-shared'; import { Button, Modal } from '@hypothesis/frontend-shared/lib/next';
export type ConfirmModalProps = { export type ConfirmModalProps = {
title?: string; title?: string;
message: string; message: ComponentChildren;
confirmAction?: string; confirmAction?: string;
}; };
...@@ -43,13 +44,26 @@ export async function confirm({ ...@@ -43,13 +44,26 @@ export async function confirm({
}; };
render( render(
<ConfirmModal <Modal
buttons={
<>
<Button data-testid="cancel-button" onClick={() => close(false)}>
Cancel
</Button>
<Button
data-testid="confirm-button"
variant="primary"
onClick={() => close(true)}
>
{confirmAction}
</Button>
</>
}
title={title} title={title}
message={message} onClose={() => close(false)}
confirmAction={confirmAction} >
onConfirm={() => close(true)} {message}
onCancel={() => close(false)} </Modal>,
/>,
container container
); );
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment