import React, { useState } from 'react';
import { PixelModal } from './PixelModal';
import { PixelButton } from '../actions';
export function Default() {
const [open, setOpen] = useState(false);
return (
<>
setOpen(true)}>Open modal
setOpen(false)} title="Default modal">
This is a minimal modal with title and body content.
>
);
}
export function Sizes() {
const [size, setSize] = useState<'sm' | 'md' | 'lg' | 'xl' | 'full' | null>(null);
return (
<>
setSize('sm')}>sm
setSize('md')}>md
setSize('lg')}>lg
setSize('xl')}>xl
setSize('full')}>full
{size && (
setSize(null)} size={size} title={`Size: ${size}`}>
Modal rendered at size {size}.
)}
>
);
}
export function Surfaces() {
const [which, setWhich] = useState<'pixel' | 'linear' | null>(null);
return (
<>
setWhich('pixel')}>Pixel surface
setWhich('linear')}>Linear surface
{which && (
setWhich(null)} surface={which} title={`${which} surface`}>
The {which} surface uses surface-aware borders, dividers, and chrome.
)}
>
);
}
export function WithDescription() {
const [open, setOpen] = useState(false);
return (
<>
setOpen(true)}>Open with description
setOpen(false)}
title="Confirm action"
description="This description is wired via aria-describedby for assistive tech."
>
Body content sits below the description.
>
);
}
export function WithFooter() {
const [open, setOpen] = useState(false);
return (
<>
setOpen(true)}>Open with footer
setOpen(false)}
title="Save changes?"
footer={
<>
setOpen(false)}>Cancel
setOpen(false)}>Save
>
}
>
Footer slot separates actions from body with a surface-aware divider.
>
);
}
export function AsyncClose() {
const [open, setOpen] = useState(false);
const asyncClose = () => new Promise((resolve) => setTimeout(resolve, 800));
return (
<>
setOpen(true)}>Open async-close
setOpen(false)}
asyncClose={asyncClose}
title="Persisting…"
>
The close button awaits the asyncClose promise before unmounting.
>
);
}
export function CustomCloseLabel() {
const [open, setOpen] = useState(false);
return (
<>
setOpen(true)}>Open with custom close label
setOpen(false)}
title="Localized"
closeLabel="Cerrar"
>
The close button announces a custom accessible label.
>
);
}