1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-07-29 01:39:36 +02:00
AdventureLog/frontend/src/routes/login/+page.svelte

97 lines
2.8 KiB
Svelte
Raw Normal View History

2024-07-08 11:44:39 -04:00
<script lang="ts">
import { enhance } from '$app/forms';
2024-10-17 21:35:55 -04:00
import { getRandomBackground, getRandomQuote } from '$lib';
2024-07-08 11:44:39 -04:00
import { onMount } from 'svelte';
export let data;
console.log(data);
2024-10-17 21:35:55 -04:00
import FileImageBox from '~icons/mdi/file-image-box';
2024-10-20 21:56:16 -04:00
let isImageInfoModalOpen: boolean = false;
2024-10-17 21:35:55 -04:00
2024-07-08 11:44:39 -04:00
import { page } from '$app/stores';
2024-10-17 21:35:55 -04:00
2024-10-20 21:56:16 -04:00
import ImageInfoModal from '$lib/components/ImageInfoModal.svelte';
import type { Background } from '$lib/types.js';
2024-07-08 11:44:39 -04:00
2024-10-20 21:56:16 -04:00
let quote: { quote: string; author: string } = data.props.quote;
2024-07-08 11:44:39 -04:00
2024-10-20 21:56:16 -04:00
let background: Background = data.props.background;
2024-07-08 11:44:39 -04:00
</script>
2024-10-20 21:56:16 -04:00
{#if isImageInfoModalOpen}
<ImageInfoModal {background} on:close={() => (isImageInfoModalOpen = false)} />
{/if}
2024-07-08 11:44:39 -04:00
<div
class="min-h-screen bg-no-repeat bg-cover flex items-center justify-center"
2024-10-17 21:35:55 -04:00
style="background-image: url('{background.url}')"
2024-07-08 11:44:39 -04:00
>
2024-10-17 21:35:55 -04:00
<div
class="card card-compact m-12 w-full max-w-4xl bg-base-100 shadow-xl p-6 flex flex-col md:flex-row"
>
<div class="flex-1">
<h3 class="text-center">AdventureLog</h3>
<article class="text-center text-4xl mb-4 font-extrabold">
<h1>Login</h1>
</article>
2024-07-08 11:44:39 -04:00
2024-10-17 21:35:55 -04:00
<div class="flex justify-center">
<form method="post" use:enhance class="w-full max-w-xs">
<label for="username">Username</label>
<input
name="username"
id="username"
class="block mb-2 input input-bordered w-full max-w-xs"
/><br />
<label for="password">Password</label>
<input
type="password"
name="password"
id="password"
class="block mb-2 input input-bordered w-full max-w-xs"
/><br />
<button class="py-2 px-4 btn btn-primary mr-2">Login</button>
2024-07-08 11:44:39 -04:00
2024-10-17 21:35:55 -04:00
<div class="flex justify-between mt-4">
<p><a href="/signup" class="underline">Sign Up</a></p>
<p><a href="/settings/forgot-password" class="underline">Forgot Password</a></p>
</div>
</form>
2024-07-08 11:44:39 -04:00
</div>
2024-10-17 21:35:55 -04:00
{#if ($page.form?.message && $page.form?.message.length > 1) || $page.form?.type === 'error'}
<div class="text-center text-error mt-4">
{$page.form.message || 'Unable to login with the provided credentials.'}
</div>
{/if}
</div>
<div class="flex-1 flex justify-center items-center mt-12 md:mt-0 md:ml-6">
<blockquote class="w-80 text-center text-2xl font-semibold break-words">
{#if quote != null}
{quote.quote}
2024-07-08 11:44:39 -04:00
{/if}
2024-10-17 21:35:55 -04:00
<footer class="text-sm mt-1">{quote.author}</footer>
2024-07-08 11:44:39 -04:00
</blockquote>
</div>
</div>
</div>
2024-10-17 21:35:55 -04:00
<div class="fixed bottom-4 right-4 z-[999]">
<div class="dropdown dropdown-left dropdown-end">
2024-10-20 21:56:16 -04:00
<button class="btn m-1 btn-circle btn-md" on:click={() => (isImageInfoModalOpen = true)}>
2024-10-17 21:35:55 -04:00
<FileImageBox class="w-4 h-4" />
2024-10-20 21:56:16 -04:00
</button>
2024-10-17 21:35:55 -04:00
</div>
</div>
2024-10-20 21:56:16 -04:00
2024-07-08 11:44:39 -04:00
<svelte:head>
<title>Login | AdventureLog</title>
<meta
name="description"
content="Login to your AdventureLog account to start logging your adventures!"
/>
</svelte:head>