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.
32 lines
1.6 KiB
React
32 lines
1.6 KiB
React
import React from 'react'
|
|
|
|
export function Sheet({ open, onOpenChange, side = 'right', width = 380, 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
|
|
const pos = side === 'left'
|
|
? { left: 0, top: 0, bottom: 0, width, borderRight: '1px solid var(--border-hairline)' }
|
|
: { right: 0, top: 0, bottom: 0, width, borderLeft: '1px solid var(--border-hairline)' }
|
|
return (
|
|
<div onClick={() => onOpenChange && onOpenChange(false)} style={{position:'fixed',inset:0,zIndex:80,background:'rgb(0 0 0 / .7)'}}>
|
|
<div
|
|
onClick={(e) => e.stopPropagation()}
|
|
style={{position:'absolute',display:'flex',flexDirection:'column',background:'var(--popover)',boxShadow:'var(--shadow-floating)',animation:'zoo-fade-up var(--duration-base) var(--ease-out)',...pos}}
|
|
>{children}</div>
|
|
</div>
|
|
)
|
|
}
|
|
export function SheetHeader({ style, children, ...rest }) {
|
|
return <div style={{padding:'20px 24px',borderBottom:'1px solid var(--border-hairline)',display:'flex',flexDirection:'column',gap:4,...style}} {...rest}>{children}</div>
|
|
}
|
|
export function SheetTitle({ style, children, ...rest }) {
|
|
return <h2 style={{fontSize:'var(--text-base)',fontWeight:'var(--weight-semibold)',color:'var(--text-primary)',...style}} {...rest}>{children}</h2>
|
|
}
|
|
export function SheetContent({ style, children, ...rest }) {
|
|
return <div style={{flex:1,overflowY:'auto',padding:24,...style}} {...rest}>{children}</div>
|
|
}
|