Skip to content

Commit

Permalink
feat: better timeline thingy
Browse files Browse the repository at this point in the history
  • Loading branch information
awwpotato committed Nov 14, 2024
1 parent 4bb7455 commit 027576e
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions src/lib/components/Timeline.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script lang="ts">
import { clickoutside } from '@svelte-put/clickoutside';
import type { AutoActionData } from '$lib/types';
import Action from './Action.svelte';
Expand All @@ -10,19 +9,23 @@
// let latestActions: AutoActionData[] = $derived(actions.toReversed().slice(0, 5));
</script>

<div
class="flex flex-col items-center bg-gunmetal text-white p-1 rounded-t-lg transition-transform gap-2 fixed h-[50svh] inset-x-0 bottom-0
{displaying ? '' : 'translate-y-full'}"
id="timeline"
use:clickoutside
onclickoutside={() => (displaying = false)}
>
{#each actions as _, i}
<Action
action_data={actions[i]}
deleteself={() => {
actions.splice(actions.indexOf(actions[i]), 1);
}}
/>
{/each}
</div>
<button
class="fixed inset-0 transition-all {displaying ? 'backdrop-blur' : 'translate-y-full'}"
onclick={() => (displaying = false)}>
<div
class="absolute h-[50svh] inset-x-0 bottom-0 flex flex-col items-center bg-gunmetal text-white p-1 rounded-t-lg gap-2"
id="timeline"
>
{#each actions as _, i}
<Action
action_data={actions[i]}
deleteself={() => {
actions.splice(actions.indexOf(actions[i]), 1);
}}
/>
{/each}
{#if actions.length === 0}
<h3 class="m-auto">No actions yet :3</h3>
{/if}
</div>
</button>

0 comments on commit 027576e

Please sign in to comment.