-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f453fff
commit b5f7f41
Showing
13 changed files
with
275 additions
and
291 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,126 @@ | ||
<script lang="ts"> | ||
import { enhance } from '$app/forms' | ||
import { Button } from '$lib/client/components/ui/button/index.js' | ||
import * as Card from '$lib/client/components/ui/card/index.js' | ||
import { Input } from '$lib/client/components/ui/input/index.js' | ||
import { Label } from '$lib/client/components/ui/label/index.js' | ||
import { page } from '$app/stores' | ||
import * as Tabs from '$lib/client/components/ui/tabs/index.js' | ||
import type { Snippet } from 'svelte' | ||
let { | ||
children, | ||
}: { | ||
children?: Snippet | ||
} = $props() | ||
const defaultForm = $page.url.searchParams.get('tab') ?? 'login' | ||
</script> | ||
|
||
<Card.Root class="mx-auto max-w-sm"> | ||
<Card.Header> | ||
<Card.Title class="text-2xl">Login</Card.Title> | ||
<Card.Description> | ||
Enter your email below to login to your account | ||
</Card.Description> | ||
</Card.Header> | ||
<Card.Content> | ||
<form class="grid gap-4" method="post" action="/login/password?/login"> | ||
<div class="grid gap-2"> | ||
<Label for="email">Email</Label> | ||
<Input id="email" type="email" placeholder="[email protected]" required /> | ||
</div> | ||
<div class="grid gap-2"> | ||
<div class="flex items-center"> | ||
<Label for="password">Password</Label> | ||
<a href="##" class="ml-auto inline-block text-sm underline"> | ||
Forgot your password? | ||
</a> | ||
<Tabs.Root value={defaultForm} class="w-[400px]"> | ||
<Tabs.List class="grid w-full grid-cols-2"> | ||
<Tabs.Trigger value="login">Login</Tabs.Trigger> | ||
<Tabs.Trigger value="signup">Signup</Tabs.Trigger> | ||
</Tabs.List> | ||
<Tabs.Content value="login"> | ||
<Card.Root> | ||
<Card.Header> | ||
<Card.Title class="text-2xl">Login</Card.Title> | ||
<Card.Description> | ||
Enter your email below to login to your account | ||
</Card.Description> | ||
</Card.Header> | ||
<Card.Content> | ||
<form | ||
class="grid gap-4" | ||
method="post" | ||
action="/login?/password" | ||
use:enhance | ||
> | ||
<div class="grid gap-2"> | ||
<Label for="email">Email</Label> | ||
<Input | ||
id="email" | ||
type="email" | ||
placeholder="[email protected]" | ||
required | ||
/> | ||
</div> | ||
<div class="grid gap-2"> | ||
<div class="flex items-center"> | ||
<Label for="password">Password</Label> | ||
<a | ||
href="/reset-password" | ||
class="ml-auto inline-block text-sm underline" | ||
> | ||
Forgot your password? | ||
</a> | ||
</div> | ||
<Input id="password" type="password" required /> | ||
</div> | ||
|
||
{@render children?.()} | ||
<Button type="submit" class="w-full">Login</Button> | ||
<Button href="/login/google" variant="outline" class="w-full"> | ||
Login with Google | ||
</Button> | ||
</form> | ||
<div class="mt-4 text-center text-sm"> | ||
Don't have an account? | ||
<Tabs.Trigger value="signup">Signup</Tabs.Trigger> | ||
</div> | ||
<Input id="password" type="password" required /> | ||
</div> | ||
</Card.Content> | ||
</Card.Root> | ||
</Tabs.Content> | ||
<Tabs.Content value="signup"> | ||
<Card.Root> | ||
<Card.Header> | ||
<Card.Title class="text-2xl">Singup</Card.Title> | ||
<Card.Description> | ||
Enter your email below to create an account | ||
</Card.Description> | ||
</Card.Header> | ||
<Card.Content> | ||
<form | ||
class="grid gap-4" | ||
method="post" | ||
action="/login?/signup" | ||
use:enhance | ||
> | ||
<div class="grid gap-2"> | ||
<Label for="username">Username</Label> | ||
<Input | ||
id="username" | ||
name="username" | ||
type="text" | ||
placeholder="username" | ||
required | ||
/> | ||
</div> | ||
<div class="grid gap-2"> | ||
<Label for="email">Email</Label> | ||
<Input | ||
id="email" | ||
type="email" | ||
name="email" | ||
placeholder="[email protected]" | ||
required | ||
/> | ||
</div> | ||
<div class="grid gap-2"> | ||
<div class="flex items-center"> | ||
<Label for="password">Password</Label> | ||
</div> | ||
<Input id="password" type="password" name='password' required /> | ||
</div> | ||
|
||
{@render children?.()} | ||
<Button type="submit" class="w-full">Login</Button> | ||
<Button href="/login/google" variant="outline" class="w-full"> | ||
Login with Google | ||
</Button> | ||
</form> | ||
<div class="mt-4 text-center text-sm"> | ||
Don't have an account? | ||
<a href="##" class="underline">Sign up</a> | ||
</div> | ||
</Card.Content> | ||
</Card.Root> | ||
{@render children?.()} | ||
<Button type="submit" class="w-full">Sign up</Button> | ||
<Button href="/login/google" variant="outline" class="w-full"> | ||
Login with Google | ||
</Button> | ||
</form> | ||
</Card.Content> | ||
</Card.Root> | ||
</Tabs.Content> | ||
</Tabs.Root> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<script lang="ts"> | ||
import { Tabs as TabsPrimitive } from "bits-ui"; | ||
import { cn } from "$lib/utils"; | ||
let { | ||
ref = $bindable(null), | ||
class: className, | ||
...restProps | ||
}: TabsPrimitive.ContentProps = $props(); | ||
</script> | ||
|
||
<TabsPrimitive.Content | ||
bind:ref | ||
class={cn( | ||
"ring-offset-background focus-visible:ring-ring mt-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2", | ||
className | ||
)} | ||
{...restProps} | ||
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<script lang="ts"> | ||
import { Tabs as TabsPrimitive } from "bits-ui"; | ||
import { cn } from "$lib/utils"; | ||
let { | ||
ref = $bindable(null), | ||
class: className, | ||
...restProps | ||
}: TabsPrimitive.ListProps = $props(); | ||
</script> | ||
|
||
<TabsPrimitive.List | ||
bind:ref | ||
class={cn( | ||
"bg-muted text-muted-foreground inline-flex h-10 items-center justify-center rounded-md p-1", | ||
className | ||
)} | ||
{...restProps} | ||
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<script lang="ts"> | ||
import { Tabs as TabsPrimitive } from "bits-ui"; | ||
import { cn } from "$lib/utils"; | ||
let { | ||
ref = $bindable(null), | ||
class: className, | ||
...restProps | ||
}: TabsPrimitive.TriggerProps = $props(); | ||
</script> | ||
|
||
<TabsPrimitive.Trigger | ||
bind:ref | ||
class={cn( | ||
"ring-offset-background focus-visible:ring-ring data-[state=active]:bg-background data-[state=active]:text-foreground inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm", | ||
className | ||
)} | ||
{...restProps} | ||
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.