feat: add minimal header to auth pages
- Create AuthHeader component with logo and contextual auth link - Show "Sign Up" on sign-in page and vice versa - Keep centered form layout with header at top 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
87a9517ec3
commit
e4b84fb1cd
2 changed files with 72 additions and 2 deletions
|
|
@ -1,9 +1,13 @@
|
|||
import { AuthHeader } from '@/components/AuthHeader';
|
||||
import type { ReactNode } from 'react';
|
||||
|
||||
export default function AuthLayout({ children }: { children: ReactNode }) {
|
||||
return (
|
||||
<div className="min-h-screen flex items-center justify-center bg-background">
|
||||
<div className="w-full max-w-md p-8">{children}</div>
|
||||
<div className="min-h-screen flex flex-col bg-background">
|
||||
<AuthHeader />
|
||||
<div className="flex-1 flex items-center justify-center">
|
||||
<div className="w-full max-w-md p-8">{children}</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
66
apps/web/src/components/AuthHeader.tsx
Normal file
66
apps/web/src/components/AuthHeader.tsx
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
'use client';
|
||||
|
||||
import { Button } from '@tpmjs/ui/Button/Button';
|
||||
import { Header } from '@tpmjs/ui/Header/Header';
|
||||
import Link from 'next/link';
|
||||
import { usePathname } from 'next/navigation';
|
||||
|
||||
/**
|
||||
* Minimal header for auth pages (sign-in, sign-up, verify-email)
|
||||
* Shows logo on left, contextual auth link on right
|
||||
*/
|
||||
export function AuthHeader(): React.ReactElement {
|
||||
const pathname = usePathname();
|
||||
const isSignIn = pathname === '/sign-in';
|
||||
const isSignUp = pathname === '/sign-up';
|
||||
|
||||
return (
|
||||
<Header
|
||||
title={
|
||||
<Link
|
||||
href="/"
|
||||
className="text-foreground hover:text-foreground text-xl md:text-2xl font-bold uppercase tracking-tight"
|
||||
>
|
||||
TPMJS
|
||||
</Link>
|
||||
}
|
||||
size="md"
|
||||
sticky={true}
|
||||
actions={
|
||||
<div className="flex items-center gap-2">
|
||||
{isSignIn && (
|
||||
<>
|
||||
<span className="text-foreground-secondary text-sm hidden sm:inline">
|
||||
Don't have an account?
|
||||
</span>
|
||||
<Link href="/sign-up">
|
||||
<Button variant="outline" size="sm">
|
||||
Sign Up
|
||||
</Button>
|
||||
</Link>
|
||||
</>
|
||||
)}
|
||||
{isSignUp && (
|
||||
<>
|
||||
<span className="text-foreground-secondary text-sm hidden sm:inline">
|
||||
Already have an account?
|
||||
</span>
|
||||
<Link href="/sign-in">
|
||||
<Button variant="outline" size="sm">
|
||||
Sign In
|
||||
</Button>
|
||||
</Link>
|
||||
</>
|
||||
)}
|
||||
{!isSignIn && !isSignUp && (
|
||||
<Link href="/sign-in">
|
||||
<Button variant="outline" size="sm">
|
||||
Sign In
|
||||
</Button>
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue