fix: improve spacing on auth screens

This commit is contained in:
Elias Schneider
2025-06-03 21:09:32 +02:00
parent eb9b6433ae
commit 04fcf1110e
3 changed files with 75 additions and 75 deletions

View File

@@ -3,6 +3,7 @@
import { m } from '$lib/paraglide/messages'; import { m } from '$lib/paraglide/messages';
import { cn } from '$lib/utils/style'; import { cn } from '$lib/utils/style';
import type { Snippet } from 'svelte'; import type { Snippet } from 'svelte';
import { MediaQuery } from 'svelte/reactivity';
import * as Card from './ui/card'; import * as Card from './ui/card';
let { let {
@@ -14,11 +15,12 @@
showAlternativeSignInMethodButton?: boolean; showAlternativeSignInMethodButton?: boolean;
animate?: boolean; animate?: boolean;
} = $props(); } = $props();
const isDesktop = new MediaQuery('min-width: 1024px');
</script> </script>
<!-- Desktop with sliding reveal animation --> {#if isDesktop.current}
<div class="hidden h-screen items-center overflow-hidden text-center lg:flex"> <div class="h-screen items-center overflow-hidden text-center">
<!-- Content area that fades in after background slides -->
<div <div
class="relative z-10 flex h-full w-[650px] p-16 {cn( class="relative z-10 flex h-full w-[650px] p-16 {cn(
showAlternativeSignInMethodButton && 'pb-0', showAlternativeSignInMethodButton && 'pb-0',
@@ -53,15 +55,16 @@
<div class="{cn(animate && 'animate-slide-bg-container')} absolute top-0 right-0 bottom-0 z-0"> <div class="{cn(animate && 'animate-slide-bg-container')} absolute top-0 right-0 bottom-0 z-0">
<img <img
src="/api/application-configuration/background-image" src="/api/application-configuration/background-image"
class="h-screen rounded-l-[60px] object-cover {animate ? 'w-full' : 'w-[calc(100vw-650px)]'}" class="h-screen rounded-l-[60px] object-cover {animate
? 'w-full'
: 'w-[calc(100vw-650px)]'}"
alt={m.login_background()} alt={m.login_background()}
/> />
</div> </div>
</div> </div>
{:else}
<!-- Mobile -->
<div <div
class="flex h-screen items-center justify-center bg-[url('/api/application-configuration/background-image')] bg-cover bg-center text-center lg:hidden" class="flex h-screen items-center justify-center bg-[url('/api/application-configuration/background-image')] bg-cover bg-center text-center"
> >
<Card.Root class="mx-3 w-full max-w-md" style={animate ? 'animation-delay: 200ms;' : ''}> <Card.Root class="mx-3 w-full max-w-md" style={animate ? 'animation-delay: 200ms;' : ''}>
<Card.CardContent <Card.CardContent
@@ -83,3 +86,4 @@
</Card.CardContent> </Card.CardContent>
</Card.Root> </Card.Root>
</div> </div>
{/if}

View File

@@ -103,9 +103,9 @@
})} })}
</p> </p>
{:else if authorizationRequired} {:else if authorizationRequired}
<div transition:slide={{ duration: 300 }}> <div class="w-full max-w-[450px]" transition:slide={{ duration: 300 }}>
<Card.Root class="mt-6 mb-10"> <Card.Root class="mt-6 mb-10">
<Card.Header class="pb-5"> <Card.Header>
<p class="text-muted-foreground text-start"> <p class="text-muted-foreground text-start">
{@html m.client_wants_to_access_the_following_information({ client: client.name })} {@html m.client_wants_to_access_the_following_information({ client: client.name })}
</p> </p>
@@ -138,11 +138,8 @@
</Card.Root> </Card.Root>
</div> </div>
{/if} {/if}
<!-- Wrap the buttons in a container with the same width as in the login code page --> <div class="flex w-full max-w-[450px] gap-2">
<div class="w-full max-w-[450px]"> <Button onclick={() => history.back()} class="flex-1" variant="secondary">{m.cancel()}</Button
<div class="mt-8 flex justify-between gap-2">
<Button onclick={() => history.back()} class="flex-1" variant="secondary"
>{m.cancel()}</Button
> >
{#if !errorMessage} {#if !errorMessage}
<Button class="flex-1" {isLoading} onclick={authorize}>{m.sign_in()}</Button> <Button class="flex-1" {isLoading} onclick={authorize}>{m.sign_in()}</Button>
@@ -150,6 +147,5 @@
<Button class="flex-1" onclick={() => (errorMessage = null)}>{m.try_again()}</Button> <Button class="flex-1" onclick={() => (errorMessage = null)}>{m.try_again()}</Button>
{/if} {/if}
</div> </div>
</div>
</SignInWrapper> </SignInWrapper>
{/if} {/if}

View File

@@ -89,7 +89,7 @@
{:else if success} {:else if success}
<p class="text-muted-foreground mt-2">{m.the_device_has_been_authorized()}</p> <p class="text-muted-foreground mt-2">{m.the_device_has_been_authorized()}</p>
{:else if authorizationRequired} {:else if authorizationRequired}
<div transition:slide={{ duration: 300 }}> <div class="w-full max-w-[450px]" transition:slide={{ duration: 300 }}>
<Card.Root class="mt-6"> <Card.Root class="mt-6">
<Card.Header class="pb-5"> <Card.Header class="pb-5">
<p class="text-muted-foreground text-start"> <p class="text-muted-foreground text-start">
@@ -110,14 +110,14 @@
</form> </form>
{/if} {/if}
{#if !success} {#if !success}
<div class="mt-10 flex w-full justify-stretch gap-2"> <div class="mt-10 flex w-full max-w-[450px] gap-2">
<Button href="/" class="w-full" variant="secondary">{m.cancel()}</Button> <Button href="/" class="flex-1" variant="secondary">{m.cancel()}</Button>
{#if !errorMessage} {#if !errorMessage}
<Button form="device-code-form" class="w-full" onclick={authorize} {isLoading} <Button form="device-code-form" class="flex-1" onclick={authorize} {isLoading}
>{m.authorize()}</Button >{m.authorize()}</Button
> >
{:else} {:else}
<Button class="w-full" onclick={() => (errorMessage = null)}>{m.try_again()}</Button> <Button class="flex-1" onclick={() => (errorMessage = null)}>{m.try_again()}</Button>
{/if} {/if}
</div> </div>
{/if} {/if}