diff options
Diffstat (limited to 'static/icons/index.js')
| -rw-r--r-- | static/icons/index.js | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/static/icons/index.js b/static/icons/index.js index 3562754..5402be0 100644 --- a/static/icons/index.js +++ b/static/icons/index.js @@ -1,29 +1,36 @@ import * as sfw from 'sfw'; const { I } = sfw.element.native; -const icons = [ - 'settings', - 'shuffle', - 'calendar', - 'search', - 'close', - 'home', - 'add', - 'edit', - 'check', - 'next', -]; +import Settings from './settings'; +import Shuffle from './shuffle'; +import Calendar from './calendar'; +import Search from './search'; +import Close from './close'; +import Home from './home'; +import Add from './add'; +import Edit from './edit'; +import Check from './check'; +import Next from './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 icons = { + 'settings': Settings, + 'shuffle': Shuffle, + 'calendar': Calendar, + 'search': Search, + 'close': Close, + 'home': Home, + 'add': Add, + 'edit': Edit, + 'check': Check, + 'next': Next, }; +const target = { icons: icons }; + const handler = { get(target, prop, receiver) { return I.new({ - innerHTML: target.icons[prop]?.default ?? '?', + innerHTML: target.icons[prop] ?? '?', className: 'icon', }); } |