-
Notifications
You must be signed in to change notification settings - Fork 0
/
c-dialog.riot
32 lines (32 loc) · 1.21 KB
/
c-dialog.riot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<c-dialog>
<dialog class="
{props?.active ? 'active ' : null}
{props?.blur ? 'overlay blur ' : null}
{props?.left ? 'left ' : null}
{props?.right ? 'right ' : null}
{props?.top ? 'top ' : null}
{props?.bottom ? 'bottom ' : null}
{props?.max ? 'max ' : null}
"
>
<h5 if={ props?.title }>{ props?.title }</h5>
<div>
{ props?.message }
<slot name="body"></slot>
</div>
<nav class="right-align no-space">
<button onclick={ (ev) => clicked(ev, "cancel") } class="transparent link" if={ !props?.disableCancel }>{ props?.cancelText ?? "cancel" }</button>
<button onclick={ (ev) => clicked(ev, "confirm") } class="transparent link" if={ !props?.disableConfirm }>{ props?.confirmText ?? "confirm" }</button>
<slot name="button"></slot>
</nav>
</dialog>
<script>
export default {
clicked (e, name) {
e.preventDefault();
e.stopPropagation();
this.root.dispatchEvent(new Event(name));
}
}
</script>
</c-dialog>