feat: add AR page preview in a phone frame
This commit is contained in:
parent
6551e5fcce
commit
4629d86289
38
app/components/ui/ar-page-preview.tsx
Normal file
38
app/components/ui/ar-page-preview.tsx
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
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>
|
||||||
|
);
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user