forked from rajun/ar-test
39 lines
1.5 KiB
TypeScript
39 lines
1.5 KiB
TypeScript
import type { ReactNode } from 'react';
|
|
import { ArPage } from '~/components/ui/ar-page';
|
|
import { PhoneFrame } from '~/components/ui/phone-frame';
|
|
import { Text } from '~/components/ui/text';
|
|
import { cn } from '~/lib/utils';
|
|
import type { ArPageLayout, BrandIdentity, ButtonStyle } from '~/types/project';
|
|
|
|
const stripes = 'repeating-linear-gradient(135deg, var(--color-viewer-stripe) 0 9px, var(--color-viewer-stripe-alt) 9px 18px)';
|
|
|
|
interface ArPagePreviewProps {
|
|
brand?: BrandIdentity;
|
|
modelName: string;
|
|
button?: ButtonStyle;
|
|
layout?: ArPageLayout;
|
|
className?: string;
|
|
// The 3D viewer; a striped placeholder is shown when omitted
|
|
children?: ReactNode;
|
|
}
|
|
|
|
export function ArPagePreview({ brand, modelName, button, layout, className, children }: ArPagePreviewProps) {
|
|
return (
|
|
<PhoneFrame className={className}>
|
|
<ArPage brand={brand} modelName={modelName} button={button} layout={layout} className='min-h-0 flex-1'>
|
|
{children ?? (
|
|
// Edge to edge when the model fills the page
|
|
<div
|
|
className={cn('absolute flex items-center justify-center', layout?.bars === false ? 'inset-0' : 'inset-x-4 inset-y-[18px] rounded-[20px]')}
|
|
style={{ backgroundImage: stripes }}
|
|
>
|
|
<Text as='span' variant='stamp' tone='viewer'>
|
|
3D model
|
|
</Text>
|
|
</div>
|
|
)}
|
|
</ArPage>
|
|
</PhoneFrame>
|
|
);
|
|
}
|