diff options
Diffstat (limited to 'static/icons/index.js')
| -rw-r--r-- | static/icons/index.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/static/icons/index.js b/static/icons/index.js new file mode 100644 index 0000000..08ab7ea --- /dev/null +++ b/static/icons/index.js @@ -0,0 +1,31 @@ +import * as sfw from 'sfw'; +const { I } = sfw.element.native; + +const icons = [ + 'settings', + 'shuffle', + 'calendar', + 'search', + 'close', + 'home', + 'add', + 'edit', + 'check', +]; + +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); |