mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-08-04 04:35:19 +02:00
commit
577371736f
5 changed files with 29 additions and 18 deletions
|
@ -17,7 +17,7 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="card min-w-max w-96 bg-neutral shadow-xl overflow-hidden">
|
<div class="card min-w-max lg:w-96 md:w-80 sm:w-60 xs:w-40 bg-neutral shadow-xl overflow-hidden">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h2 class="card-title overflow-ellipsis">{name}</h2>
|
<h2 class="card-title overflow-ellipsis">{name}</h2>
|
||||||
<p><img src={locationDot} class="inline-block -mt-1 mr-1" alt="Logo" />{location}</p>
|
<p><img src={locationDot} class="inline-block -mt-1 mr-1" alt="Logo" />{location}</p>
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
let modal: HTMLDialogElement;
|
let modal: HTMLDialogElement;
|
||||||
|
|
||||||
|
let originalName = editName;
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
modal = document.getElementById("my_modal_1") as HTMLDialogElement;
|
modal = document.getElementById("my_modal_1") as HTMLDialogElement;
|
||||||
if (modal) {
|
if (modal) {
|
||||||
|
@ -27,11 +29,19 @@
|
||||||
function close() {
|
function close() {
|
||||||
dispatch('close');
|
dispatch('close');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleKeydown(event: KeyboardEvent) {
|
||||||
|
if (event.key === 'Escape') {
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<dialog id="my_modal_1" class="modal">
|
<dialog id="my_modal_1" class="modal" >
|
||||||
<div class="modal-box">
|
<!-- svelte-ignore a11y-no-noninteractive-element-interactions -->
|
||||||
<h3 class="font-bold text-lg">Edit Adventure {editName}</h3>
|
<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
|
||||||
|
<div class="modal-box" role="dialog" on:keydown={handleKeydown} tabindex="0">
|
||||||
|
<h3 class="font-bold text-lg">Edit Adventure {originalName}</h3>
|
||||||
<p class="py-4">Press ESC key or click the button below to close</p>
|
<p class="py-4">Press ESC key or click the button below to close</p>
|
||||||
<div class="modal-action">
|
<div class="modal-action">
|
||||||
<form method="dialog">
|
<form method="dialog">
|
||||||
|
|
|
@ -9,15 +9,15 @@
|
||||||
goto('/log');
|
goto('/log');
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<div class="navbar bg-base-100">
|
<div class="navbar bg-base-100 flex flex-col md:flex-row">
|
||||||
<div class="navbar-start">
|
<div class="navbar-start flex justify-around md:justify-start">
|
||||||
<button class="btn btn-primary mr-4 ml-2" on:click={goHome}>Home</button>
|
<button class="btn btn-primary my-2 md:my-0 md:mr-4 md:ml-2" on:click={goHome}>Home</button>
|
||||||
<button class="btn btn-primary" on:click={goToLog}>My Log</button>
|
<button class="btn btn-primary my-2 md:my-0" on:click={goToLog}>My Log</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="navbar-center">
|
<div class="navbar-center flex justify-center md:justify-center">
|
||||||
<a class="btn btn-ghost text-xl" href="/">AdventureLog 🗺️</a>
|
<a class="btn btn-ghost text-xl" href="/">AdventureLog 🗺️</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="navbar-end">
|
<div class="navbar-end flex justify-around md:justify-end">
|
||||||
<p>Adventures: {getNumberOfAdventures()} </p>
|
<p>Adventures: {getNumberOfAdventures()} </p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
import Footer from "$lib/components/Footer.svelte";
|
import Footer from "$lib/components/Footer.svelte";
|
||||||
import Navbar from "$lib/components/Navbar.svelte";
|
import Navbar from "$lib/components/Navbar.svelte";
|
||||||
import "../app.css";
|
import "../app.css";
|
||||||
|
|
||||||
|
// only show footer if scrolled to the bottom
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Navbar />
|
<Navbar />
|
||||||
|
@ -10,10 +13,10 @@
|
||||||
</section>
|
</section>
|
||||||
<!-- <Footer /> -->
|
<!-- <Footer /> -->
|
||||||
|
|
||||||
<style>
|
<!-- <style>
|
||||||
section {
|
section {
|
||||||
margin-top: 2rem;
|
margin-top: 2rem;
|
||||||
margin-bottom: 5rem;
|
margin-bottom: 5rem;
|
||||||
/* gives the footer space! */
|
/* gives the footer space! */
|
||||||
}
|
}
|
||||||
</style>
|
</style> -->
|
|
@ -10,8 +10,6 @@
|
||||||
import SucessToast from "$lib/components/SucessToast.svelte";
|
import SucessToast from "$lib/components/SucessToast.svelte";
|
||||||
import mapDrawing from "$lib/assets/adventure_map.svg"
|
import mapDrawing from "$lib/assets/adventure_map.svg"
|
||||||
import EditModal from "$lib/components/EditModal.svelte";
|
import EditModal from "$lib/components/EditModal.svelte";
|
||||||
import { Input } from "postcss";
|
|
||||||
|
|
||||||
|
|
||||||
let newName = '';
|
let newName = '';
|
||||||
let newLocation = '';
|
let newLocation = '';
|
||||||
|
@ -112,21 +110,21 @@
|
||||||
<EditModal bind:editId={editId} bind:editName={editName} bind:editLocation={editLocation} bind:editCreated={editCreated} on:submit={saveAdventure} on:close={handleClose} />
|
<EditModal bind:editId={editId} bind:editName={editName} bind:editLocation={editLocation} bind:editCreated={editCreated} on:submit={saveAdventure} on:close={handleClose} />
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<div class="grid grid-cols-3 gap-4 mt-4 content-center auto-cols-auto ml-6">
|
<div class="grid xl:grid-cols-3 lg:grid-cols-3 md:grid-cols-2 sm:grid-cols-1 gap-4 mt-4 content-center auto-cols-auto ml-6 mr-6">
|
||||||
{#each adventures as adventure (adventure.id)}
|
{#each adventures as adventure (adventure.id)}
|
||||||
<AdventureCard id={adventure.id} name={adventure.name} location={adventure.location} created={adventure.created} on:remove={triggerRemoveAdventure} on:edit={editAdventure} />
|
<AdventureCard id={adventure.id} name={adventure.name} location={adventure.location} created={adventure.created} on:remove={triggerRemoveAdventure} on:edit={editAdventure} />
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if adventures.length == 0}
|
{#if adventures.length == 0}
|
||||||
<div class="flex flex-col items-center justify-center mt-28">
|
<div class="flex flex-col items-center justify-center mt-16">
|
||||||
<article class="prose mb-4"><h2>Add some adventures!</h2></article>
|
<article class="prose mb-4"><h2>Add some adventures!</h2></article>
|
||||||
<img src={mapDrawing} width="25%" alt="Logo" />
|
<img src={mapDrawing} width="25%" alt="Logo" />
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if adventures.length != 0}
|
{#if adventures.length != 0}
|
||||||
<div class="flex flex-row items-center justify-center mt-28 gap-4">
|
<div class="flex flex-row items-center justify-center mt-16 gap-4">
|
||||||
<button class="btn btn-neutral" on:click={async () => { window.location.href = exportData(); }}>
|
<button class="btn btn-neutral" on:click={async () => { window.location.href = exportData(); }}>
|
||||||
<img src={exportFile} class="inline-block -mt-1" alt="Logo" /> Save as File
|
<img src={exportFile} class="inline-block -mt-1" alt="Logo" /> Save as File
|
||||||
</button>
|
</button>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue