From 6380ea699d9c07c48cf456de62b954ab17dc27a0 Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Mon, 14 May 2018 21:53:13 +0100 Subject: [PATCH] Use big
to hide user menu in a more intuitive fashion. --- redesign/usermenu.nim | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/redesign/usermenu.nim b/redesign/usermenu.nim index 9673dcf..6d0d8c7 100644 --- a/redesign/usermenu.nim +++ b/redesign/usermenu.nim @@ -19,15 +19,31 @@ when defined(js): onLogout: onLogout ) + proc onClick(e: Event, n: VNode, state: UserMenu) = + state.shown = not state.shown + proc render*(state: UserMenu, user: User): VNode = result = buildHtml(): tdiv(): figure(class="avatar c-hand", - onClick=(e: Event, n: VNode) => (state.shown = not state.shown)): + onClick=(e: Event, n: VNode) => onClick(e, n, state)): img(src=user.avatarUrl, title=user.name) if user.isOnline: italic(class="avatar-presense online") + tdiv(style=style([ + (StyleAttr.width, kstring"999999px"), + (StyleAttr.height, kstring"999999px"), + (StyleAttr.position, kstring"absolute"), + (StyleAttr.left, kstring"0"), + (StyleAttr.top, kstring"0"), + ( + StyleAttr.display, + if state.shown: kstring"block" else: kstring"none" + ) + ]), + onClick=(e: Event, n: VNode) => (state.shown = false)) + ul(class="menu menu-right", style=style( StyleAttr.display, if state.shown: "inherit" else: "none" )):