mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-06-05 22:09:38 +02:00
fix: Fix Material web pre15 BC
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import '@material/web/icon/icon.js';
|
||||
import '@material/web/list/list-item-link.js';
|
||||
import '@material/web/list/list-item.js';
|
||||
|
||||
import {router} from '@maicol07/inertia-mithril';
|
||||
import {ListItemLink} from '@material/web/list/internal/listitemlink/list-item-link';
|
||||
import {ListItemEl} from '@material/web/list/internal/listitem/list-item';
|
||||
import type * as MaterialIcons from '@mdi/js';
|
||||
import MdIcon from '@osm/Components/MdIcon';
|
||||
import {Vnode} from 'mithril';
|
||||
@@ -14,17 +14,17 @@ import {ValueOf} from 'type-fest';
|
||||
|
||||
type Icons = ValueOf<typeof MaterialIcons>;
|
||||
|
||||
export interface DrawerEntryAttributes extends Attributes, Partial<ListItemLink> {
|
||||
href: ListItemLink['href'];
|
||||
export interface DrawerEntryAttributes extends Attributes, Partial<ListItemEl> {
|
||||
href: ListItemEl['href'];
|
||||
icon: Icons;
|
||||
}
|
||||
|
||||
export class DrawerEntry<A extends DrawerEntryAttributes = DrawerEntryAttributes> extends Component<A> {
|
||||
view(vnode: Vnode<A>) {
|
||||
return (
|
||||
<md-list-item-link headline={vnode.children as string} active={this.isRouteActive(vnode.attrs.href)} href={vnode.attrs.href} onclick={this.navigateToRoute.bind(this)} {...this.attrs.all()}>
|
||||
<md-list-item headline={vnode.children as string} active={this.isRouteActive(vnode.attrs.href)} href={vnode.attrs.href} onclick={this.navigateToRoute.bind(this)} {...this.attrs.all()}>
|
||||
<MdIcon icon={vnode.attrs.icon} slot="start"/>
|
||||
</md-list-item-link>
|
||||
</md-list-item>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -34,6 +34,6 @@ export class DrawerEntry<A extends DrawerEntryAttributes = DrawerEntryAttributes
|
||||
|
||||
navigateToRoute(event: Event) {
|
||||
event.preventDefault();
|
||||
router.visit((event.target as ListItemLink).href);
|
||||
router.visit((event.target as ListItemEl).href);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user