Files
pocket-id/frontend/src/lib/components/login-wrapper.svelte

70 lines
2.0 KiB
Svelte
Raw Normal View History

2024-08-12 11:00:25 +02:00
<script lang="ts">
import { page } from '$app/state';
2024-08-12 11:00:25 +02:00
import type { Snippet } from 'svelte';
import * as Card from './ui/card';
import { m } from '$lib/paraglide/messages';
2024-08-12 11:00:25 +02:00
let {
2025-01-19 15:30:31 +01:00
children,
showAlternativeSignInMethodButton = false
2024-08-12 11:00:25 +02:00
}: {
children: Snippet;
showAlternativeSignInMethodButton?: boolean;
2024-08-12 11:00:25 +02:00
} = $props();
</script>
2025-01-19 15:30:31 +01:00
<!-- Desktop -->
2024-08-12 11:00:25 +02:00
<div class="hidden h-screen items-center text-center lg:flex">
<div class="h-full min-w-[650px] p-16 {showAlternativeSignInMethodButton ? 'pb-0' : ''}">
<div class="flex h-full flex-col">
<div class="flex flex-grow flex-col items-center justify-center">
{@render children()}
2025-01-19 15:30:31 +01:00
</div>
{#if showAlternativeSignInMethodButton}
<div class="mb-4 flex justify-center">
<a
href={page.url.pathname == '/login'
? '/login/alternative'
: `/login/alternative?redirect=${encodeURIComponent(
page.url.pathname + page.url.search
)}`}
class="text-muted-foreground text-xs"
>
{m.dont_have_access_to_your_passkey()}
</a>
</div>
{/if}
</div>
2024-08-12 11:00:25 +02:00
</div>
<img
2024-08-13 18:32:21 +02:00
src="/api/application-configuration/background-image"
2024-08-12 11:00:25 +02:00
class="h-screen w-[calc(100vw-650px)] rounded-l-[60px] object-cover"
alt={m.login_background()}
2024-08-12 11:00:25 +02:00
/>
</div>
2025-01-19 15:30:31 +01:00
<!-- Mobile -->
2024-08-12 11:00:25 +02:00
<div
2024-08-13 21:06:29 +02:00
class="flex h-screen items-center justify-center bg-[url('/api/application-configuration/background-image')] bg-cover bg-center text-center lg:hidden"
2024-08-12 11:00:25 +02:00
>
<Card.Root class="mx-3">
2025-01-19 15:30:31 +01:00
<Card.CardContent
class="px-4 py-10 sm:p-10 {showAlternativeSignInMethodButton ? 'pb-3 sm:pb-3' : ''}"
2025-01-19 15:30:31 +01:00
>
{@render children()}
{#if showAlternativeSignInMethodButton}
<a
href={page.url.pathname == '/login'
? '/login/alternative'
: `/login/alternative?redirect=${encodeURIComponent(
page.url.pathname + page.url.search
)}`}
class="text-muted-foreground mt-7 flex justify-center text-xs"
>
{m.dont_have_access_to_your_passkey()}
</a>
2024-08-12 11:00:25 +02:00
{/if}
</Card.CardContent>
</Card.Root>
</div>