Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

1.7 KB
Raw Blame
import { type ReactNode, useEffect, useState } from "react";
import { cn } from "@/lib/cn";
import { hasAuthEntered, markAuthEntered } from "./auth-entrance";
import { AuthLegalFooter } from "./auth-legal-footer";

type AuthPageProps = {
  title: string;
  description?: ReactNode;
  notice?: ReactNode;
  children?: ReactNode;
};

export function AuthPage({
  title,
  description,
  notice,
  children,
}: AuthPageProps) {
  const [isEntering] = useState(() => !hasAuthEntered());

  useEffect(markAuthEntered, []);

  return (
    <main
      className={cn(
        "h-svh w-full overflow-y-auto bg-background",
        isEntering && "motion-shell-enter",
      )}
    >
      <div className="flex min-h-full flex-col items-center">
        <div className="flex w-full grow flex-col items-center justify-center px-4 py-12 sm:px-6">
          <div
            className={cn(
              "flex w-full max-w-[360px] flex-col",
              isEntering && "motion-shell-rise",
            )}
          >
            <div className="flex flex-col gap-5 pb-8">
              <img
                src="/favicon.svg"
                alt=""
                className="size-10 shrink-0 rounded-lg border border-border"
              />
              <div className="flex flex-col gap-1.5">
                <h1 className="font-semibold text-[22px] text-foreground leading-7 tracking-[-0.02em]">
                  {title}
                </h1>
                {description ? (
                  <p className="text-muted-foreground text-sm">{description}</p>
                ) : null}
              </div>
              {notice}
            </div>
            {children}
          </div>
        </div>
        <AuthLegalFooter />
      </div>
    </main>
  );
}