type PreviewDeviceKind = 'laptop' | 'tablet' | 'cellphone'; type PreviewDeviceSpec = { width: number; height: number; frameClassName: string; screenClassName: string; }; type PreviewDeviceFrameProps = { device: PreviewDeviceKind; children: JSX.Element; className?: string; }; const DEVICE_SPECS: Record = { laptop: { width: 1280, height: 720, frameClassName: 'relative rounded-xl border-[10px] border-slate-700 bg-slate-800 px-2 pb-2 pt-4 shadow', screenClassName: 'overflow-hidden rounded-md border border-slate-700 bg-white', }, tablet: { width: 800, height: 920, frameClassName: 'relative rounded-[28px] border-[10px] border-slate-700 bg-slate-800 px-2 pb-2 pt-4 shadow', screenClassName: 'overflow-hidden rounded-[18px] border border-slate-700 bg-white', }, cellphone: { width: 375, height: 667, frameClassName: 'relative rounded-[30px] border-[10px] border-slate-700 bg-slate-800 px-2 pb-2 pt-4 shadow', screenClassName: 'overflow-hidden rounded-[20px] border border-slate-700 bg-white', }, }; const renderTopChrome = ( device: PreviewDeviceKind ) => { if ( device === 'laptop' ) { return (
); } if ( device === 'tablet' ) { return (
); } return (
); }; const PreviewDeviceFrame = ( { device, children, className = '' }: PreviewDeviceFrameProps ) => { const spec = DEVICE_SPECS[ device ]; return (
{ renderTopChrome( device ) }
{ children }
); }; export type { PreviewDeviceKind, PreviewDeviceFrameProps }; export default PreviewDeviceFrame;