Update icons

This commit is contained in:
Georgi Gardev
2023-11-19 19:48:45 +02:00
parent b52fad7b3c
commit 991e32cacc
3 changed files with 13 additions and 5 deletions

View File

@@ -1,2 +1,9 @@
export const getAppIcon = (icon: string) =>
`https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/${icon}.png`;
const ICON_SOURCES: Record<string, (icon: string) => string> = {
'homelab-svg-assets': (icon) =>
`https://raw.githubusercontent.com/loganmarchione/homelab-svg-assets/main/assets/${icon}.svg`,
'dashboard-icons': (icon) =>
`https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/${icon}.png`,
};
export const getAppIcon = (icon: string, source: string = 'homelab-svg-assets') =>
ICON_SOURCES[source](icon);

View File

@@ -5,9 +5,9 @@ import { AppDefinition } from '~/types';
import style from './App.module.css';
export type PillProps = AppDefinition;
export type AppProps = AppDefinition;
export function App(props: PillProps) {
export function App(props: AppProps) {
const { appSettings } = useSettings();
return (
@@ -20,7 +20,7 @@ export function App(props: PillProps) {
<span class={style.Url}>{props.location}</span>
</Show>
</div>
<img class={style.Icon} src={getAppIcon(props.icon)} alt={props.name} />
<img class={style.Icon} src={getAppIcon(props.icon, props.icon_source)} alt={props.name} />
<Show when={props.shortcut}>
<span class={style.Index}>{props.shortcut}</span>
</Show>

View File

@@ -9,6 +9,7 @@ export type AppDefinition = {
name: string;
url: string;
icon: string;
icon_source?: string;
tags: string;
location?: string;
shortcut?: string;