mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-06-05 22:09:38 +02:00
chore: Usa solo href
nel DrawerEntry
This commit is contained in:
@@ -14,22 +14,21 @@ import {ValueOf} from 'type-fest';
|
||||
|
||||
type Icons = ValueOf<typeof MaterialIcons>;
|
||||
|
||||
export interface DrawerEntryAttributes extends Attributes {
|
||||
route: string;
|
||||
export interface DrawerEntryAttributes extends Attributes, ListItemLink {
|
||||
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.route)} href={route(vnode.attrs.route)} onclick={this.navigateToRoute.bind(this)}>
|
||||
<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()}>
|
||||
<MdIcon icon={vnode.attrs.icon} slot="start"/>
|
||||
</md-list-item-link>
|
||||
);
|
||||
}
|
||||
|
||||
isRouteActive(routeName: string) {
|
||||
return route().current(routeName);
|
||||
isRouteActive(href: string) {
|
||||
return route(route().current()!) === href;
|
||||
}
|
||||
|
||||
navigateToRoute(event: Event) {
|
||||
|
Reference in New Issue
Block a user