'use client' import clsx from 'clsx' import Link from 'next/link' import type { MouseEvent, ReactNode } from 'react' type SwitchAction = { text: string linkLabel: string href: string } export type AuthLayoutSocialButton = { label: string href: string icon: ReactNode disabled?: boolean onClick?: (event: MouseEvent) => void } type AlertType = 'error' | 'success' | 'info' type AuthLayoutProps = { mode: 'login' | 'register' badge?: string title: string description?: string alert?: { type: AlertType; message: string } | null socialHeading?: string socialButtons?: AuthLayoutSocialButton[] aboveForm?: ReactNode children: ReactNode footnote?: ReactNode bottomNote?: string switchAction: SwitchAction } function AuthLayoutTab({ href, active, children }: { href: string; active: boolean; children: ReactNode }) { return ( {children} ) } function AuthSocialButton({ label, href, icon, disabled, onClick }: AuthLayoutSocialButton) { const handleClick = (event: MouseEvent) => { if (disabled) { event.preventDefault() event.stopPropagation() } onClick?.(event) } return ( {icon} {label} ) } export function AuthLayout({ mode, badge, title, description, alert, socialHeading, socialButtons = [], aboveForm, children, footnote, bottomNote, switchAction, }: AuthLayoutProps) { return (
Svc.Plus

Cloud-Neutral · 自由中立

Sign In Sign Up
{badge ? ( {badge} ) : null}

{title}

{description ?

{description}

: null}
{alert ? (
{alert.message}
) : null} {aboveForm}
{children}
{socialButtons.length > 0 ? (
{socialHeading ?? 'Or continue with'}
{socialButtons.map(button => ( ))}
) : null}

{switchAction.text}{' '} {switchAction.linkLabel}

{footnote ?
{footnote}
: null}
{bottomNote ?

{bottomNote}

: null}
) }