widget is now a bus, add t-on directive on widgets

This commit is contained in:
Géry Debongnie
2019-02-02 18:17:21 +01:00
parent 0e1e0da3e7
commit fdd11907fb
6 changed files with 57 additions and 10 deletions
+2 -3
View File
@@ -2,8 +2,7 @@ import { Widget } from "../core/widget";
import { Env, Menu } from "../env";
export interface Props {
toggleHome: () => void;
inMenu: boolean;
inHome: boolean;
}
export class Navbar extends Widget<Env, Props> {
@@ -16,6 +15,6 @@ export class Navbar extends Widget<Env, Props> {
toggleHome(ev: MouseEvent) {
ev.preventDefault();
this.props.toggleHome();
this.trigger("toggle-home-menu");
}
}
+3 -3
View File
@@ -14,7 +14,7 @@ import { Notification } from "./notification";
interface State {
notifications: INotification[];
stack: ActionStack;
inMenu: boolean;
inHome: boolean;
}
//------------------------------------------------------------------------------
@@ -28,7 +28,7 @@ export class Root extends Widget<Env, {}> {
state: State = {
notifications: [],
stack: [],
inMenu: false
inHome: false
};
constructor(env: Env) {
@@ -47,6 +47,6 @@ export class Root extends Widget<Env, {}> {
}
toggleHome() {
this.updateState({ inMenu: !this.state.inMenu });
this.updateState({ inHome: !this.state.inHome });
}
}