aboutsummaryrefslogtreecommitdiff
path: root/static/icons/index.js
blob: 35627548d4d659ac16141e8bc3ef321eb6cb28a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import * as sfw from 'sfw';
const { I } = sfw.element.native;

const icons = [
	'settings',
	'shuffle',
	'calendar',
	'search',
	'close',
	'home',
	'add',
	'edit',
	'check',
	'next',
];

const target = {
	icons: await Promise.all(
		icons.map(async v => [v, await import(`./${v}.js`)])
	).then(r => r.reduce((obj, [v, m]) => (obj[v] = m, obj), {})),
};

const handler = {
	get(target, prop, receiver) {
		return I.new({
			innerHTML: target.icons[prop]?.default ?? '?',
			className: 'icon',
		});
	}
};

export default new Proxy(target, handler);