mirror of
https://github.com/zooai/design.git
synced 2026-10-30 14:50:04 +00:00
Monochrome, dark by default. One hue rendered through an opacity ladder. Tokens (color, type, spacing, radius, elevation, motion) + core/forms/navigation/ overlays components + brand guidelines + ui kit. The single source of truth for every Zoo surface — loadable and editable.
42 lines
2.0 KiB
React
42 lines
2.0 KiB
React
import React from 'react'
|
|
|
|
export function Dialog({ open, onOpenChange, children }) {
|
|
React.useEffect(() => {
|
|
if (!open) return
|
|
const onKey = (e) => { if (e.key === 'Escape') onOpenChange && onOpenChange(false) }
|
|
document.addEventListener('keydown', onKey)
|
|
return () => document.removeEventListener('keydown', onKey)
|
|
}, [open, onOpenChange])
|
|
if (!open) return null
|
|
return (
|
|
<div
|
|
onClick={() => onOpenChange && onOpenChange(false)}
|
|
style={{position:'fixed',inset:0,zIndex:80,display:'flex',alignItems:'center',justifyContent:'center',padding:24,background:'rgb(0 0 0 / .8)',backdropFilter:'blur(4px)',animation:'zoo-fade-up var(--duration-fast) var(--ease-out)'}}
|
|
>
|
|
{children}
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export function DialogContent({ width = 480, style, children, ...rest }) {
|
|
return (
|
|
<div
|
|
role="dialog" aria-modal="true" onClick={(e) => e.stopPropagation()}
|
|
style={{width:'100%',maxWidth:width,maxHeight:'85vh',overflowY:'auto',padding:24,display:'flex',flexDirection:'column',gap:16,background:'var(--popover)',color:'var(--popover-foreground)',border:'1px solid var(--border-hairline)',borderRadius:'var(--radius-xl)',boxShadow:'var(--shadow-floating)',...style}}
|
|
{...rest}
|
|
>{children}</div>
|
|
)
|
|
}
|
|
export function DialogHeader({ style, children, ...rest }) {
|
|
return <div style={{display:'flex',flexDirection:'column',gap:6,...style}} {...rest}>{children}</div>
|
|
}
|
|
export function DialogTitle({ style, children, ...rest }) {
|
|
return <h2 style={{fontSize:'var(--text-lg)',fontWeight:'var(--weight-semibold)',color:'var(--text-primary)',...style}} {...rest}>{children}</h2>
|
|
}
|
|
export function DialogDescription({ style, children, ...rest }) {
|
|
return <p style={{fontSize:'var(--text-sm)',lineHeight:'var(--leading-relaxed)',color:'var(--text-helper)',...style}} {...rest}>{children}</p>
|
|
}
|
|
export function DialogFooter({ style, children, ...rest }) {
|
|
return <div style={{display:'flex',justifyContent:'flex-end',gap:8,...style}} {...rest}>{children}</div>
|
|
}
|