forked from rajun/ar-test
36 lines
2.0 KiB
TypeScript
36 lines
2.0 KiB
TypeScript
import type { ReactNode } from 'react';
|
|
import { Text } from '~/components/ui/text';
|
|
import { cn } from '~/lib/utils';
|
|
|
|
interface PhoneFrameProps {
|
|
// light: the customer AR page; dark: a camera view, with white status bar and home indicator
|
|
tone?: 'light' | 'dark';
|
|
className?: string;
|
|
children: ReactNode;
|
|
}
|
|
|
|
// A phone outline with a status bar, for previewing the customer view
|
|
export function PhoneFrame({ tone = 'light', className, children }: PhoneFrameProps) {
|
|
const dark = tone === 'dark';
|
|
return (
|
|
<div className={cn('shrink-0 rounded-phone bg-phone-frame p-[9px] shadow-[0_30px_60px] shadow-shadow/45 ring-1 ring-phone-frame-edge', className)}>
|
|
<div className={cn('relative flex h-full flex-col overflow-hidden rounded-phone-screen', dark ? 'bg-camera' : 'bg-viewer')}>
|
|
<div aria-hidden='true' className='relative z-10 flex items-center justify-between px-[26px] pt-[13px]'>
|
|
<Text as='span' variant='body-strong' tone={dark ? 'default' : 'ink'}>9:41</Text>
|
|
<span className='h-5 w-[70px] rounded-full bg-ink' />
|
|
{/* Battery: 70% charged, white on camera screens and ink on the light page so it stays visible */}
|
|
<span className={cn('relative flex h-3 w-6 rounded-[4px] border p-px', dark ? 'border-text-primary/60' : 'border-ink/50')}>
|
|
<span className={cn('w-[70%] rounded-[2px]', dark ? 'bg-text-primary' : 'bg-ink')} />
|
|
<span className={cn('absolute top-1/2 -right-[3px] h-1 w-0.5 -translate-y-1/2 rounded-r-full', dark ? 'bg-text-primary/60' : 'bg-ink/50')} />
|
|
</span>
|
|
</div>
|
|
{children}
|
|
<span
|
|
aria-hidden='true'
|
|
className={cn('absolute bottom-2 left-1/2 z-10 h-1 w-[110px] -translate-x-1/2 rounded-full', dark ? 'bg-text-primary' : 'bg-ink')}
|
|
/>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|