ModalDialog wraps showModal(): the page behind is inert and does not scroll, focus starts on the first control and returns to the opener, or to the first control of its nearest container when the opener is gone. Escape and close requests only ask the consumer. Dialog gains aria-labelledby and an optional described message; the confirmations pass theirs. The mobile drawer uses the same primitive and closes at the sidebar breakpoint.
30 lines
752 B
TypeScript
30 lines
752 B
TypeScript
import Button from '@/components/ui/Button'
|
|
import Dialog from '@/components/ui/Dialog'
|
|
import { useT } from '@/i18n/useT'
|
|
|
|
export interface DisclaimerDialogProps {
|
|
text: string
|
|
onAcknowledge: () => void
|
|
}
|
|
|
|
/** Scope disclaimer of the sheet, shown once per tab session. */
|
|
export default function DisclaimerDialog({
|
|
text,
|
|
onAcknowledge,
|
|
}: DisclaimerDialogProps) {
|
|
const t = useT()
|
|
return (
|
|
<Dialog
|
|
open
|
|
onClose={onAcknowledge}
|
|
title={t('editor.disclaimer_title')}
|
|
description={<p className="text-sm text-[var(--color-ink)]">{text}</p>}
|
|
size="md"
|
|
>
|
|
<div className="mt-4 flex justify-end">
|
|
<Button onClick={onAcknowledge}>{t('common.understood')}</Button>
|
|
</div>
|
|
</Dialog>
|
|
)
|
|
}
|