From 8ab50b2c5e10d09813b563ddb5d4cf62d992753d Mon Sep 17 00:00:00 2001 From: Maximilian Liebmann Date: Fri, 9 May 2025 17:38:07 +0200 Subject: [PATCH] refactor: restyle login page with UI components Improves the login page's visual appearance by using Card and Input components. --- src/app/login/page.tsx | 22 +++--- src/components/labeled-input.tsx | 48 ++++--------- src/components/ui/card.tsx | 92 ++++++++++++++++++++++++ src/components/ui/input.tsx | 21 ++++++ src/components/user/login-form.tsx | 2 +- src/components/user/sso-login-button.tsx | 2 +- 6 files changed, 142 insertions(+), 45 deletions(-) create mode 100644 src/components/ui/card.tsx create mode 100644 src/components/ui/input.tsx diff --git a/src/app/login/page.tsx b/src/app/login/page.tsx index 6532785..b843b45 100644 --- a/src/app/login/page.tsx +++ b/src/app/login/page.tsx @@ -4,6 +4,7 @@ import LoginForm from '@/components/user/login-form'; import { redirect } from 'next/navigation'; import '@/app/globals.css'; +import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; export default async function LoginPage() { const session = await auth(); @@ -14,17 +15,20 @@ export default async function LoginPage() { return (
-
-

Login

+ + + Login + + + - +
-
- - {process.env.AUTH_AUTHENTIK_ISSUER && ( - - )} -
+ {process.env.AUTH_AUTHENTIK_ISSUER && ( + + )} + +
); } diff --git a/src/components/labeled-input.tsx b/src/components/labeled-input.tsx index 572fa01..af8879e 100644 --- a/src/components/labeled-input.tsx +++ b/src/components/labeled-input.tsx @@ -1,48 +1,28 @@ +import { Input } from '@/components/ui/input'; + export default function LabeledInput({ type, - width, label, placeholder, value, }: { type: 'text' | 'email' | 'password'; - width?: number; - label?: string; + label: string; placeholder?: string; value?: string; }) { const randomId = Math.random().toString(36).substring(2, 15); - if (!label) { - return ( -
- -
- ); - } else { - return ( -
- + return ( +
+ - -
- ); - } + +
+ ); } diff --git a/src/components/ui/card.tsx b/src/components/ui/card.tsx new file mode 100644 index 0000000..32a06b1 --- /dev/null +++ b/src/components/ui/card.tsx @@ -0,0 +1,92 @@ +import * as React from 'react'; + +import { cn } from '@/lib/utils'; + +function Card({ className, ...props }: React.ComponentProps<'div'>) { + return ( +
+ ); +} + +function CardHeader({ className, ...props }: React.ComponentProps<'div'>) { + return ( +
+ ); +} + +function CardTitle({ className, ...props }: React.ComponentProps<'div'>) { + return ( +
+ ); +} + +function CardDescription({ className, ...props }: React.ComponentProps<'div'>) { + return ( +
+ ); +} + +function CardAction({ className, ...props }: React.ComponentProps<'div'>) { + return ( +
+ ); +} + +function CardContent({ className, ...props }: React.ComponentProps<'div'>) { + return ( +
+ ); +} + +function CardFooter({ className, ...props }: React.ComponentProps<'div'>) { + return ( +
+ ); +} + +export { + Card, + CardHeader, + CardFooter, + CardTitle, + CardAction, + CardDescription, + CardContent, +}; diff --git a/src/components/ui/input.tsx b/src/components/ui/input.tsx new file mode 100644 index 0000000..485626a --- /dev/null +++ b/src/components/ui/input.tsx @@ -0,0 +1,21 @@ +import * as React from 'react'; + +import { cn } from '@/lib/utils'; + +function Input({ className, type, ...props }: React.ComponentProps<'input'>) { + return ( + + ); +} + +export { Input }; diff --git a/src/components/user/login-form.tsx b/src/components/user/login-form.tsx index 0dbd6e7..47e1945 100644 --- a/src/components/user/login-form.tsx +++ b/src/components/user/login-form.tsx @@ -3,7 +3,7 @@ import { Button } from '@/components/ui/button'; export default function LoginForm() { return ( -
+ { 'use server'; await signIn(provider);