ar-test/app/components/auth/showcase/login-showcase.tsx
2026-10-27 16:28:57 +05:30

55 lines
3.1 KiB
TypeScript

import { useId, useState } from 'react';
import { StoryPhone } from '~/components/auth/showcase/story-phone';
import { StorySteps } from '~/components/auth/showcase/story-steps';
import { BrandLockup } from '~/components/ui/brand-lockup';
import { Glow } from '~/components/ui/glow';
import { Text } from '~/components/ui/text';
import { LOGIN_STORY } from '~/data/auth/constants';
const fadeUp = 'linear-gradient(to top, black, transparent)';
const floorGrid = {
backgroundImage:
'linear-gradient(var(--color-border-divider) 1px, transparent 1px), linear-gradient(90deg, var(--color-border-divider) 1px, transparent 1px)',
backgroundSize: '64px 64px',
maskImage: fadeUp,
WebkitMaskImage: fadeUp,
};
// Hidden on phones; under the form on tablets; the left side from 960px, with the text beside the phone from 1200px
export function LoginShowcase() {
const headingId = useId();
const [story, setStory] = useState({ step: 0, cycle: 0 });
// A new cycle restarts the progress bar, even when the current step is picked again
const select = (step: number) => setStory((s) => ({ step, cycle: s.cycle + 1 }));
const steps = { active: story.step, cycle: story.cycle, onSelect: select, onComplete: () => select((story.step + 1) % LOGIN_STORY.length) };
return (
<aside
aria-labelledby={headingId}
className='relative hidden flex-col overflow-hidden border-t border-border-divider bg-sidebar px-6 pt-12 pb-16 sm:flex split:order-first split:min-h-screen split:flex-1 split:border-t-0 split:px-10 split:py-9 wide:px-14 wide:py-10'
>
<Glow intensity='strong' className='top-[48%] left-1/2 h-[45%] w-1/2 -translate-1/2 wide:left-[72%]' />
<div aria-hidden='true' className='pointer-events-none absolute -inset-x-[30%] -bottom-[8%] h-[42%] origin-bottom [transform:perspective(600px)_rotateX(64deg)]' style={floorGrid} />
<BrandLockup size='md' className='relative hidden split:flex' />
<div className='relative flex flex-1 flex-col items-center justify-center gap-8 split:pt-10 split:pb-2 wide:flex-row wide:gap-12'>
<div className='flex w-full max-w-[520px] flex-col items-center gap-5.5 text-center wide:max-w-[400px] wide:flex-[1_1_300px] wide:items-stretch wide:gap-8 wide:text-left'>
<div className='flex flex-col gap-3.5'>
<Text as='h2' id={headingId} variant='hero'>
Step into{' '}
<Text as='span' variant='inherit' tone='primary'>
augmented reality.
</Text>
</Text>
<Text variant='lead'>From a printed tag to a sofa in the living room in three taps. No app to install.</Text>
</div>
<StorySteps layout='card' {...steps} className='hidden wide:flex' />
<StorySteps layout='pill' {...steps} className='wide:hidden' />
</div>
<StoryPhone step={story.step} />
</div>
</aside>
);
}