import { isString, binaryTweenPipeAtom, makeGeneralEventHandler, TERMINATOR } from 'MobiusUtils' import { makeInstantComponent, makeVerticalDockE } from 'MobiusGUI' import { appRouteDriverInstance, appNameRD } from 'Interfaces/services/app-route' import type { Terminator } from 'MobiusUtils' import type { DockItem } from 'MobiusGUI' const { inputs: { navigate } } = appRouteDriverInstance const [clickHandlerRD, , clickD] = makeGeneralEventHandler((event) => { const page = event.target.dataset.page return isString(page) ? `/${page}` : TERMINATOR }) binaryTweenPipeAtom(clickD, navigate) // @reference: svg 图标来自 https://www.xicons.org/ https://www.iconfont.cn/ const dockItems: DockItem[] = [ { icon: { type: 'svg', path: ` `, viewBox: '0 0 1024 1024' }, title: 'Home', route: 'home' }, { icon: { type: 'svg', path: ` `, viewBox: '0 0 1024 1024' }, title: 'Layout', route: 'layout' }, { icon: { type: 'svg', path: ` `, viewBox: '0 0 1024 1024' }, title: 'Container', route: 'container' }, { icon: { type: 'svg', path: ` `, viewBox: '0 0 32 32' }, title: 'Content', route: 'content' }, { icon: { type: 'svg', path: ` `, viewBox: '0 0 28 28' }, title: 'Display', route: 'display' }, { icon: { type: 'svg', path: ` `, viewBox: '0 0 24 24' }, title: 'Form', route: 'form' }, { icon: { type: 'svg', path: ` `, viewBox: '0 0 24 24' }, title: 'Help', route: 'help' } ] export const dockRD = makeInstantComponent( [appNameRD, clickHandlerRD], ([appName, clickHandler]) => { return makeVerticalDockE({ styles: { classes: '', items: dockItems.map(item => ({ ...item, isSelected: appName === item.route })) }, actuations: { clickHandler } }) } )