Establishes the ui.* namespace for phases 2 and 3. Both catalogs complete, so the key-parity test holds. Two English copy defects fixed while keying, because the Portuguese must not inherit them: 'Your are not authorized' -> 'You are', and 'Please Signin again' -> 'Please sign in again'. The server's own message in ServerError/CustomError stays verbatim — it is a response, not UI copy (D1).
41 lines
2.0 KiB
TypeScript
41 lines
2.0 KiB
TypeScript
import type { ReactNode } from 'react';
|
|
import { Dialog, DialogOverlay, DialogPortal } from '@/components/ui/dialog';
|
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
import { cardStyle } from '@/components/Card';
|
|
import { useTranslation } from '@/components/locales';
|
|
|
|
type PaperDialogProps = {
|
|
open: boolean;
|
|
onOpenChange: (open: boolean) => void;
|
|
onOpenAutoFocus?: (ev: Event) => void;
|
|
children: ReactNode;
|
|
};
|
|
|
|
export const PaperDialog = ({ open, onOpenChange, onOpenAutoFocus, children }: PaperDialogProps) => {
|
|
const { t } = useTranslation();
|
|
|
|
const handleOpenAutoFocus = (ev: Event) => {
|
|
ev.preventDefault();
|
|
onOpenAutoFocus?.(ev);
|
|
};
|
|
|
|
return (
|
|
<Dialog open={open} onOpenChange={onOpenChange}>
|
|
<DialogPortal>
|
|
<DialogOverlay className="z-[600]" />
|
|
<DialogPrimitive.Content
|
|
onOpenAutoFocus={handleOpenAutoFocus}
|
|
className="fixed left-[50%] top-[50%] z-[600] grid w-full max-w-md translate-x-[-50%] translate-y-[-50%] gap-4 border-2 border-duck-dark/30 text-duck-dark p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg"
|
|
style={cardStyle()}
|
|
>
|
|
<DialogPrimitive.Close className="absolute end-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
|
|
<span className="h-4 w-4 text-duck-dark">✕</span>
|
|
<span className="sr-only">{t('button.close')}</span>
|
|
</DialogPrimitive.Close>
|
|
{children}
|
|
</DialogPrimitive.Content>
|
|
</DialogPortal>
|
|
</Dialog>
|
|
);
|
|
};
|