Skip to content

Commit

Permalink
move the notification clear button up
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Oct 3, 2021
1 parent 5af50b8 commit eb15e36
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 31 deletions.
14 changes: 7 additions & 7 deletions ui/notify/css/_notify.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
padding: 2rem 0;
}

.clear {
display: flex;
justify-content: flex-end;
button {
&:hover {
color: $c-bad;
}
.delete {
position: absolute;
top: 0;
right: 0;
padding: 0.5rem;
&:hover {
color: $c-bad;
}
}

Expand Down
38 changes: 14 additions & 24 deletions ui/notify/src/view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,22 @@ function renderContent(ctrl: Ctrl, d: NotifyData): VNode[] {

const nodes: VNode[] = [];

if (pager.previousPage)
nodes.push(
h('div.pager.prev', {
attrs: { 'data-icon': '' },
hook: clickHook(ctrl.previousPage),
})
);
else if (pager.nextPage)
nodes.push(
h('div.pager.prev.disabled', {
attrs: { 'data-icon': '' },
})
);
nodes.push(
h(`div.pager.prev${pager.previousPage ? '' : '.disabled'}`, {
attrs: { 'data-icon': '' },
hook: clickHook(ctrl.previousPage),
})
);

if (nb > 0 && pager.currentPage == 1)
if (nb > 0)
nodes.push(
h(
'div.clear',
h('button.delete.button.button-empty', {
attrs: {
'data-icon': '',
title: 'Clear',
},
hook: clickHook(ctrl.clear),
})
)
h('button.delete.button.button-empty', {
attrs: {
'data-icon': '',
title: 'Clear',
},
hook: clickHook(ctrl.clear),
})
);

nodes.push(nb ? recentNotifications(d, ctrl.scrolling()) : empty());
Expand Down

0 comments on commit eb15e36

Please sign in to comment.