feat: make download icon theme aware

This commit is contained in:
Igor Bedesqui
2023-12-11 20:59:09 -03:00
parent 20b2dd5155
commit b8a102d99b
+20 -1
View File
@@ -90,7 +90,26 @@
<button <button
title="Download" title="Download"
on:click={() => { on:click={() => {
downloadSvg(typeof svgInfo.route !== 'string' ? svgInfo.route.dark : svgInfo.route); const svgHasTheme = typeof svgInfo.route !== 'string';
if (!svgHasTheme) {
downloadSvg(
typeof svgInfo.route === 'string'
? svgInfo.route
: "Something went wrong. Couldn't copy the SVG."
);
return;
}
const dark = document.documentElement.classList.contains('dark');
downloadSvg(
typeof svgInfo.route !== 'string'
? dark
? svgInfo.route.dark
: svgInfo.route.light
: svgInfo.route
);
}} }}
class="flex items-center space-x-2 rounded-md p-2 duration-100 hover:bg-neutral-200 dark:hover:bg-neutral-700/40" class="flex items-center space-x-2 rounded-md p-2 duration-100 hover:bg-neutral-200 dark:hover:bg-neutral-700/40"
> >