import type { Meta, StoryObj } from '@storybook/nextjs-vite'; import { useState } from 'react'; import { AuthShell, type AuthSsoProvider, LoginForm, type LoginFormProps } from '../../components/features/auth'; import { TabSelector } from '../../components/ui/tab-selector'; const meta = { title: 'Auth/Login', component: LoginForm, parameters: { layout: 'fullscreen', docs: { description: { component: 'Login tab from the auth redesign. Presentational + controlled. Shown inside the full responsive AuthShell (desktop two-column, tablet/mobile stacked). Use the viewport toolbar to check breakpoints.', }, }, }, tags: ['autodocs'], } satisfies Meta; export default meta; type Story = StoryObj; /** Full page: Sign Up / Login tabs + Login form + marketing panel. */ function LoginPage(initial: Partial) { const [tab, setTab] = useState('login'); const [email, setEmail] = useState(initial.email ?? ''); const isValid = !!email.trim(); const tabs = ( ); return ( {tab === 'login' ? ( {}} termsUrl="#terms" privacyPolicyUrl="#privacy" /> ) : (
Sign Up — see Auth/Create Organization
)}
); } /** Empty email, submit disabled. */ export const Empty: Story = { render: () => , }; /** Valid email entered, Continue enabled (accent). */ export const Filled: Story = { render: () => , }; /** The generic providers, which need nothing typed and render above the email field. */ const SSO_PROVIDERS: AuthSsoProvider[] = ['google', 'microsoft', 'apple']; /** Providers above the email field, before anything is typed. */ export const SSO: Story = { render: () => , }; /** Discovery resolved a tenant that has its own SSO: its options appear under the email. */ export const CustomSso: Story = { render: () => , }; /** Discovery resolved a tenant with none configured — the empty array is the answer, not silence. */ export const NoCustomSso: Story = { render: () => , };