diff --git a/app/components/ui/ar-launch-button.tsx b/app/components/ui/ar-launch-button.tsx new file mode 100644 index 0000000..f081dbe --- /dev/null +++ b/app/components/ui/ar-launch-button.tsx @@ -0,0 +1,61 @@ +import type { CSSProperties } from 'react'; +import { Box, Loader2 } from 'lucide-react'; +import { Button } from '~/components/ui/button'; +import { Text } from '~/components/ui/text'; +import { AR_BUTTON_LABEL } from '~/data/ar-viewer/constants'; +import { BUTTON_SIZES } from '~/data/projects/constants'; +import { cn } from '~/lib/utils'; +import type { ButtonStyle } from '~/types/project'; + +// Measurements for the chosen size: a pill preset, or the project's exact custom values +function boxStyle({ size = 'md', custom }: ButtonStyle): CSSProperties { + if (size === 'custom' && custom) { + return { + height: custom.height, + width: custom.width ?? undefined, + paddingInline: custom.paddingX, + borderRadius: custom.radius, + border: custom.borderWidth ? `${custom.borderWidth}px solid ${custom.borderColor}` : undefined, + }; + } + const { height, paddingX } = BUTTON_SIZES[size === 'sm' || size === 'lg' ? size : 'md']; + return { height, paddingInline: paddingX }; +} + +interface ArLaunchButtonProps { + style?: ButtonStyle; + launching?: boolean; + hint?: string | null; + onLaunch?: () => void; + // Placement of the button row, e.g. over the model + className?: string; +} + +// "View in your space" button; takes the client's colour, text colour, label and size when the project sets them +export function ArLaunchButton({ style = {}, launching, hint, onLaunch, className }: ArLaunchButtonProps) { + const preview = !onLaunch; + return ( +
+ +
+ ); +}