feat: make icon theme aware.

This commit is contained in:
Igor Bedesqui
2023-12-11 20:58:05 -03:00
parent 73f71f3dd6
commit 3d23d22ed2
5 changed files with 22 additions and 4 deletions
+11 -2
View File
@@ -41,7 +41,16 @@
<CardSpotlight>
<div class="flex flex-col items-center justify-center rounded-md p-4">
<img src={svgInfo.route} alt={svgInfo.title} class="mb-4 mt-2 h-10" />
<img
class="hidden dark:block mb-4 mt-2 h-10"
src={typeof svgInfo.route !== 'string' ? svgInfo.route.dark : svgInfo.route}
alt={svgInfo.title}
/>
<img
class="block dark:hidden mb-4 mt-2 h-10"
src={typeof svgInfo.route !== 'string' ? svgInfo.route.light : svgInfo.route}
alt={svgInfo.title}
/>
<div class="mb-3 flex flex-col items-center justify-center">
<p class="truncate text-[15px] font-medium">{svgInfo.title}</p>
<a
@@ -62,7 +71,7 @@
<button
title="Download"
on:click={() => {
downloadSvg(svgInfo.route);
downloadSvg(typeof svgInfo.route !== 'string' ? svgInfo.route.dark : 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"
>
+4 -1
View File
@@ -1720,7 +1720,10 @@ export const svgs: iSVG[] = [
id: 775133760594,
title: 'Axiom',
category: 'Software',
route: '/library/axiom.svg',
route: {
dark: '/library/axiom-dark.svg',
light: '/library/axiom-light.svg'
},
url: 'https://axiom.co/'
}
];
+6 -1
View File
@@ -4,6 +4,11 @@ export interface iSVG {
id: number;
title: string;
category: tCategory;
route: string;
route:
| string // for backwards compat of when theme support was not added
| {
dark: string;
light: string;
};
url: string;
}