refactor: simplify logic

This commit is contained in:
madkarmaa
2025-11-12 10:46:45 +01:00
parent baea96a4be
commit d47c1bffbe

View File

@@ -1,5 +1,4 @@
<script lang="ts">
import { onMount } from 'svelte';
import { slide } from 'svelte/transition';
import { cubicInOut } from 'svelte/easing';
import storable from '@madkarma/svelte-storable';
@@ -26,16 +25,9 @@
}: Props = $props();
const Icon = type === 'info' ? Info : type === 'warning' ? Warning : Error;
let visible = $state(false);
onMount(() => {
if (closed) return;
visible = true;
});
</script>
{#if visible}
{#if !closed}
<div class="banner {type}" {id} transition:slide={{ duration: 200, easing: cubicInOut }}>
<Icon />
@@ -49,7 +41,6 @@
type="button"
onclick={() => {
closed = true;
visible = false;
$readBannerIds = [...$readBannerIds, id];
}}
>