Add svelte-sonner.

This commit is contained in:
pheralb 2023-07-07 09:34:08 +01:00
parent 539d103a1e
commit 5470b17afb
2 changed files with 12 additions and 10 deletions

View File

@ -1,6 +1,6 @@
<script lang="ts">
import download from 'downloadjs';
import toast from 'svelte-french-toast';
import { toast } from 'svelte-sonner';
import type { iSVG } from '../types/svg';
import { MIMETYPE, getSvgContent } from '../utils/getSvgContent';
@ -15,10 +15,7 @@
// Download SVG:
const downloadSvg = (url?: string) => {
download(url || '');
toast('Downloading', {
icon: '🎉',
style: 'border-radius: 200px; background: #333; color: #fff;'
});
toast.success('Downloading...');
};
// Copy SVG to clipboard:
@ -33,9 +30,8 @@
const content = (await getSvgContent(url, false)) as string;
await navigator.clipboard.writeText(content);
}
toast('Copied to clipboard', {
icon: '👏',
style: 'border-radius: 200px; background: #333; color: #fff;'
toast.message('Copied to clipboard!', {
description: `${svgInfo.title} - ${svgInfo.category}`
});
};
</script>

View File

@ -18,7 +18,7 @@
import Star from 'phosphor-svelte/lib/Star';
// Toaster:
import { Toaster } from 'svelte-french-toast';
import { Toaster } from 'svelte-sonner';
// Components for all pages:
import Transition from '@/components/transition.svelte';
@ -124,6 +124,12 @@
<Transition pathname={data.pathname}>
<slot />
</Transition>
<Toaster position="bottom-center" />
<Toaster
position="bottom-right"
toastOptions={{
class:
'font-sans dark:bg-neutral-800 dark:text-white bg-neutral-200 text-neutral-800 border dark:border-neutral-900 border-neutral-300'
}}
/>
</div>
</main>