From 8b51e6816edfea1320537ec80d3416af7443705f Mon Sep 17 00:00:00 2001 From: Bart van der Braak Date: Tue, 30 Jan 2024 01:50:59 +0100 Subject: [PATCH] feat: shadcnify the login page --- .../src/lib/components/site/icons/index.ts | 4 +- .../ui/alert/alert-description.svelte | 13 ++ .../components/ui/alert/alert-title.svelte | 21 +++ .../src/lib/components/ui/alert/alert.svelte | 17 +++ apps/web/src/lib/components/ui/alert/index.ts | 32 +++++ apps/web/src/routes/(auth)/login/+page.svelte | 127 ++++++++++-------- apps/web/src/routes/+layout.svelte | 2 +- 7 files changed, 161 insertions(+), 55 deletions(-) create mode 100644 apps/web/src/lib/components/ui/alert/alert-description.svelte create mode 100644 apps/web/src/lib/components/ui/alert/alert-title.svelte create mode 100644 apps/web/src/lib/components/ui/alert/alert.svelte create mode 100644 apps/web/src/lib/components/ui/alert/index.ts diff --git a/apps/web/src/lib/components/site/icons/index.ts b/apps/web/src/lib/components/site/icons/index.ts index 7a0a45b..c1d5f31 100644 --- a/apps/web/src/lib/components/site/icons/index.ts +++ b/apps/web/src/lib/components/site/icons/index.ts @@ -1,4 +1,5 @@ import type { Icon as LucideIcon } from 'lucide-svelte'; +import { Loader2 } from 'lucide-svelte'; import { GithubLogo, VercelLogo, LinkedinLogo } from 'radix-icons-svelte'; import Logo from './logo.svelte'; import Svelte from './svelte.svelte'; @@ -10,5 +11,6 @@ export const Icons = { gitHub: GithubLogo, svelte: Svelte, vercel: VercelLogo, - linkedIn: LinkedinLogo + linkedIn: LinkedinLogo, + spinner: Loader2 }; diff --git a/apps/web/src/lib/components/ui/alert/alert-description.svelte b/apps/web/src/lib/components/ui/alert/alert-description.svelte new file mode 100644 index 0000000..42a9133 --- /dev/null +++ b/apps/web/src/lib/components/ui/alert/alert-description.svelte @@ -0,0 +1,13 @@ + + +
+ +
diff --git a/apps/web/src/lib/components/ui/alert/alert-title.svelte b/apps/web/src/lib/components/ui/alert/alert-title.svelte new file mode 100644 index 0000000..72d0138 --- /dev/null +++ b/apps/web/src/lib/components/ui/alert/alert-title.svelte @@ -0,0 +1,21 @@ + + + + + diff --git a/apps/web/src/lib/components/ui/alert/alert.svelte b/apps/web/src/lib/components/ui/alert/alert.svelte new file mode 100644 index 0000000..8c6790f --- /dev/null +++ b/apps/web/src/lib/components/ui/alert/alert.svelte @@ -0,0 +1,17 @@ + + + diff --git a/apps/web/src/lib/components/ui/alert/index.ts b/apps/web/src/lib/components/ui/alert/index.ts new file mode 100644 index 0000000..2ece0cd --- /dev/null +++ b/apps/web/src/lib/components/ui/alert/index.ts @@ -0,0 +1,32 @@ +import { tv, type VariantProps } from "tailwind-variants"; + +import Root from "./alert.svelte"; +import Description from "./alert-description.svelte"; +import Title from "./alert-title.svelte"; + +export const alertVariants = tv({ + base: "relative w-full rounded-lg border px-4 py-3 text-sm [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground", + variants: { + variant: { + default: "bg-background text-foreground", + destructive: + "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive" + } + }, + defaultVariants: { + variant: "default" + } +}); + +export type Variant = VariantProps["variant"]; +export type HeadingLevel = "h1" | "h2" | "h3" | "h4" | "h5" | "h6"; + +export { + Root, + Description, + Title, + // + Root as Alert, + Description as AlertDescription, + Title as AlertTitle +}; diff --git a/apps/web/src/routes/(auth)/login/+page.svelte b/apps/web/src/routes/(auth)/login/+page.svelte index b29edd2..999796a 100644 --- a/apps/web/src/routes/(auth)/login/+page.svelte +++ b/apps/web/src/routes/(auth)/login/+page.svelte @@ -1,59 +1,80 @@ - -
-

- Login to your account -

-

- Or register if you don't already have an account. -

-
-
- - +
+
+
+

Log into your account

+

+ Enter your email and password below to log into your account +

-
- - -
- - -
- -
- {#if form?.notVerified} -
-
- - You must verify your email before you can login. +
+ +
+
+ + +
+
+ + +
+ +
+ {#if form?.notVerified} + + + + You must verify your email before you can login. + + + {/if} + +
+
+ +
+
+ Or continue with
- {/if} - -
\ No newline at end of file + +
+

+ Don't have an account? Sign up.
+ Forgot password? Reset password. +

+
+
diff --git a/apps/web/src/routes/+layout.svelte b/apps/web/src/routes/+layout.svelte index 30ac010..285f941 100644 --- a/apps/web/src/routes/+layout.svelte +++ b/apps/web/src/routes/+layout.svelte @@ -12,7 +12,7 @@
-
+