From 7c408bd19c2f0e00a6cecab81223f34ab17c2712 Mon Sep 17 00:00:00 2001 From: Bart van der Braak Date: Tue, 6 Feb 2024 15:44:46 +0100 Subject: [PATCH] feat: tabs for login/register --- .../lib/components/site/nav/user-nav.svelte | 3 +- apps/web/src/lib/components/ui/tabs/index.ts | 18 +++ .../components/ui/tabs/tabs-content.svelte | 21 +++ .../lib/components/ui/tabs/tabs-list.svelte | 19 +++ .../components/ui/tabs/tabs-trigger.svelte | 25 ++++ apps/web/src/routes/(auth)/auth/+page.svelte | 137 +++++++++--------- 6 files changed, 156 insertions(+), 67 deletions(-) create mode 100644 apps/web/src/lib/components/ui/tabs/index.ts create mode 100644 apps/web/src/lib/components/ui/tabs/tabs-content.svelte create mode 100644 apps/web/src/lib/components/ui/tabs/tabs-list.svelte create mode 100644 apps/web/src/lib/components/ui/tabs/tabs-trigger.svelte diff --git a/apps/web/src/lib/components/site/nav/user-nav.svelte b/apps/web/src/lib/components/site/nav/user-nav.svelte index 6cdbb85..4ebc05a 100644 --- a/apps/web/src/lib/components/site/nav/user-nav.svelte +++ b/apps/web/src/lib/components/site/nav/user-nav.svelte @@ -45,6 +45,5 @@ {:else} - - + {/if} diff --git a/apps/web/src/lib/components/ui/tabs/index.ts b/apps/web/src/lib/components/ui/tabs/index.ts new file mode 100644 index 0000000..f1ab372 --- /dev/null +++ b/apps/web/src/lib/components/ui/tabs/index.ts @@ -0,0 +1,18 @@ +import { Tabs as TabsPrimitive } from "bits-ui"; +import Content from "./tabs-content.svelte"; +import List from "./tabs-list.svelte"; +import Trigger from "./tabs-trigger.svelte"; + +const Root = TabsPrimitive.Root; + +export { + Root, + Content, + List, + Trigger, + // + Root as Tabs, + Content as TabsContent, + List as TabsList, + Trigger as TabsTrigger, +}; diff --git a/apps/web/src/lib/components/ui/tabs/tabs-content.svelte b/apps/web/src/lib/components/ui/tabs/tabs-content.svelte new file mode 100644 index 0000000..3866292 --- /dev/null +++ b/apps/web/src/lib/components/ui/tabs/tabs-content.svelte @@ -0,0 +1,21 @@ + + + + + diff --git a/apps/web/src/lib/components/ui/tabs/tabs-list.svelte b/apps/web/src/lib/components/ui/tabs/tabs-list.svelte new file mode 100644 index 0000000..d271564 --- /dev/null +++ b/apps/web/src/lib/components/ui/tabs/tabs-list.svelte @@ -0,0 +1,19 @@ + + + + + diff --git a/apps/web/src/lib/components/ui/tabs/tabs-trigger.svelte b/apps/web/src/lib/components/ui/tabs/tabs-trigger.svelte new file mode 100644 index 0000000..3e4cc7e --- /dev/null +++ b/apps/web/src/lib/components/ui/tabs/tabs-trigger.svelte @@ -0,0 +1,25 @@ + + + + + diff --git a/apps/web/src/routes/(auth)/auth/+page.svelte b/apps/web/src/routes/(auth)/auth/+page.svelte index 3928e3d..3c8c33a 100644 --- a/apps/web/src/routes/(auth)/auth/+page.svelte +++ b/apps/web/src/routes/(auth)/auth/+page.svelte @@ -4,6 +4,7 @@ import { Button } from '$lib/components/ui/button'; import { Input } from '$lib/components/ui/input'; import { Label } from '$lib/components/ui/label'; + import * as Tabs from '$lib/components/ui/tabs'; import * as Alert from '$lib/components/ui/alert'; import * as DropdownMenu from '$lib/components/ui/dropdown-menu'; import { cn } from '$lib/utils'; @@ -42,80 +43,85 @@
-
-
-

Log into your account

-

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

-
-
+ + + Login + Register + + +
+

Log into your account

+

+ Enter your credentials below to log into your account +

+
+
+
{ + isLoading = true; + }} + > +
+
+ + +
+
+ + +
+ +
+ {#if form?.notVerified} + + + You must verify your email before you can login. + + {/if} +
+
+
+ + + + {#if providers.length}
{ isLoading = true; }} > -
-
- - -
-
- - -
- -
- {#if form?.notVerified} - - - You must verify your email before you can login. - - {/if} -
-
- -
{ - isLoading = true; - }} - > - {#if providers.length}
- Or continue with + Or continue with
@@ -142,7 +148,7 @@
{#if providers.length > 1}
- +
@@ -177,10 +183,11 @@
{/if}
- {/if} - -
-

+ + {/if} + + +

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