refactor(ui): toast bileşeninde reactive store kullan

This commit is contained in:
2026-02-03 12:39:47 +03:00
parent d705e37d85
commit 92cdb4ee61

View File

@@ -2,16 +2,6 @@
import { toast } from '../stores/toastStore.js';
import { fade } from 'svelte/transition';
let toastData = {
message: null,
type: 'success',
visible: false
};
toast.subscribe(value => {
toastData = value;
});
const icons = {
success: 'fa-solid fa-circle-check',
error: 'fa-solid fa-circle-exclamation',
@@ -19,11 +9,11 @@
};
</script>
{#if toastData.visible && toastData.message}
{#if $toast.visible && $toast.message}
<div class="toast-container" transition:fade={{ duration: 200 }}>
<div class="toast {toastData.type}">
<i class="{icons[toastData.type] || icons.info}"></i>
<span>{toastData.message}</span>
<div class="toast {$toast.type}">
<i class="{icons[$toast.type] || icons.info}"></i>
<span>{$toast.message}</span>
</div>
</div>
{/if}