Skip to content

Commit de5e608

Browse files
Update bottomNavigationBar to import icons.
1 parent 2a4decc commit de5e608

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/lib/components/BottomNavigationBar.svelte

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
import { language, languageDefault, refs, s, theme } from '$lib/data/stores';
99
import { gotoRoute } from '$lib/navigate';
1010
11+
const menuIcons = import.meta.glob('$assets/icons/menu-items/*', { eager: true });
12+
// TODO Updated Vite to allow using the base option in glob imports.
13+
// This will allow us to use the final file name as a key in menuIcons, rather than the whole path,
14+
// allowing us to eliminate this variable.
15+
const menuIconBasePath = '/src/generatedAssets/icons/menu-items';
16+
1117
let { barType = undefined } = $props();
1218
1319
const bottomNavBarItems = config?.bottomNavBarItems;
@@ -128,7 +134,8 @@
128134
<picture class:invert={$theme === 'Dark'}>
129135
<!-- Image Icon -->
130136
<img
131-
src="{base}/icons/menu-items/{item.images[0].file}"
137+
src={menuIcons[`${menuIconBasePath}/${item.images[0].file}`]
138+
.default}
132139
alt=""
133140
class={selectedLink(item.type, item.link['default'])
134141
? 'opacity-100'

0 commit comments

Comments
 (0)