AuthSplitLayout.tsx 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import { Link, usePage } from '@inertiajs/react';
  2. import { type PropsWithChildren } from 'react';
  3. import { AppLogoIcon } from '@/common/AppLogoIcon';
  4. import { type SharedData } from '@/common/types';
  5. import { home } from '@/routes';
  6. interface AuthLayoutProps {
  7. title?: string;
  8. description?: string;
  9. }
  10. export default function AuthSplitLayout({ children, title, description }: PropsWithChildren<AuthLayoutProps>) {
  11. const { name, quote } = usePage<SharedData>().props;
  12. return (
  13. <div className="relative grid h-dvh flex-col items-center justify-center px-8 sm:px-0 lg:max-w-none lg:grid-cols-2 lg:px-0">
  14. <div className="relative hidden h-full flex-col bg-muted p-10 text-white lg:flex dark:border-r">
  15. <div className="absolute inset-0 bg-zinc-900" />
  16. <Link href={home()} className="relative z-20 flex items-center text-lg font-medium">
  17. <AppLogoIcon className="mr-2 size-8 fill-current text-white" />
  18. {name}
  19. </Link>
  20. {quote && (
  21. <div className="relative z-20 mt-auto">
  22. <blockquote className="space-y-2">
  23. <p className="text-lg">&ldquo;{quote.message}&rdquo;</p>
  24. <footer className="text-sm text-neutral-300">{quote.author}</footer>
  25. </blockquote>
  26. </div>
  27. )}
  28. </div>
  29. <div className="w-full lg:p-8">
  30. <div className="mx-auto flex w-full flex-col justify-center space-y-6 sm:w-[350px]">
  31. <Link href={home()} className="relative z-20 flex items-center justify-center lg:hidden">
  32. <AppLogoIcon className="h-10 fill-current text-black sm:h-12" />
  33. </Link>
  34. <div className="flex flex-col items-start gap-2 text-left sm:items-center sm:text-center">
  35. <h1 className="text-xl font-medium">{title}</h1>
  36. <p className="text-sm text-balance text-muted-foreground">{description}</p>
  37. </div>
  38. {children}
  39. </div>
  40. </div>
  41. </div>
  42. );
  43. }