use card
This commit is contained in:
parent
8786ae4dec
commit
a53512090a
3 changed files with 16 additions and 41 deletions
|
|
@ -1,27 +0,0 @@
|
||||||
<script lang="ts">
|
|
||||||
import type { Snippet } from 'svelte';
|
|
||||||
import { fade as fadeTransition } from 'svelte/transition';
|
|
||||||
import type { SvelteHTMLElements } from 'svelte/elements';
|
|
||||||
import { twMerge } from 'tailwind-merge';
|
|
||||||
|
|
||||||
type Props = {
|
|
||||||
children?: Snippet;
|
|
||||||
fade?: boolean;
|
|
||||||
} & SvelteHTMLElements['div'];
|
|
||||||
|
|
||||||
let { children, fade = false, ...props }: Props = $props();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<div
|
|
||||||
transition:fadeTransition={{ duration: fade ? 200 : 0 }}
|
|
||||||
{...props}
|
|
||||||
class={twMerge('container-body', props.class)}
|
|
||||||
>
|
|
||||||
{@render children?.()}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.container-body {
|
|
||||||
@apply container h-fit w-fit max-w-lg animate-fade rounded-lg bg-base-200 p-8 transition-transform;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
import Container from './Container.svelte';
|
|
||||||
|
|
||||||
export default Container;
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Button from '$lib/components/common/Button';
|
import Button from '$lib/components/common/Button';
|
||||||
import Container from '$lib/components/common/Container';
|
|
||||||
import TextInput from '$lib/components/common/TextInput';
|
import TextInput from '$lib/components/common/TextInput';
|
||||||
import Tabs from '$lib/components/Navigation/Tabs';
|
import Tabs from '$lib/components/Navigation/Tabs';
|
||||||
import { fade } from 'svelte/transition';
|
import { fade } from 'svelte/transition';
|
||||||
|
|
@ -21,21 +20,27 @@
|
||||||
{/snippet}
|
{/snippet}
|
||||||
|
|
||||||
{#snippet form(variant: 'login' | 'register')}
|
{#snippet form(variant: 'login' | 'register')}
|
||||||
<form class="flex w-full flex-col items-center gap-6" method="POST" action={`?/${variant}`}>
|
<form method="POST" action={`?/${variant}`}>
|
||||||
|
<div class="card-body gap-4">
|
||||||
<TextInput start={userIcon} placeholder="Email" name="email" type="email" />
|
<TextInput start={userIcon} placeholder="Email" name="email" type="email" />
|
||||||
<TextInput start={passwordIcon} placeholder="Password" name="password" type="password" />
|
<TextInput start={passwordIcon} placeholder="Password" name="password" type="password" />
|
||||||
{#if variant === 'register'}
|
{#if variant === 'register'}
|
||||||
<TextInput start={nameIcon} placeholder="Name" name="name" fade />
|
<TextInput start={nameIcon} placeholder="Name" name="name" fade />
|
||||||
{/if}
|
{/if}
|
||||||
|
</div>
|
||||||
|
<div class="card-actions px-4">
|
||||||
<Button block type="submit" label="Submit" outline />
|
<Button block type="submit" label="Submit" outline />
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
|
|
||||||
<div class="page" transition:fade>
|
<div class="page" transition:fade>
|
||||||
<Container>
|
<div class="card bg-base-200 py-4 shadow-xl">
|
||||||
|
<div class="card-title">
|
||||||
<Tabs variant="bordered" bind:selected={tab} tabs={['Login', 'Register']} />
|
<Tabs variant="bordered" bind:selected={tab} tabs={['Login', 'Register']} />
|
||||||
|
</div>
|
||||||
{@render form(tab === 0 ? 'login' : 'register')}
|
{@render form(tab === 0 ? 'login' : 'register')}
|
||||||
</Container>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue