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
+4 -8
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>