Skip to content

Commit

Permalink
fix(modal): add DDAU for modal visibility (#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
fkm authored and czosel committed May 14, 2019
1 parent 8a1ae19 commit 6a3ddef
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions addon/components/uk-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import UIkit from "uikit";
import { scheduleOnce } from "@ember/runloop";
import { getOwner } from "@ember/application";

const noop = () => {};

export default Component.extend({
layout,

Expand All @@ -30,11 +32,11 @@ export default Component.extend({
},

_show() {
this.modal && this.set("visible", true);
this.getWithDefault("on-show", noop)();
},

_hide() {
this.modal && this.set("visible", false);
this.getWithDefault("on-hide", noop)();
},

didInsertElement() {
Expand Down
2 changes: 2 additions & 0 deletions tests/dummy/app/templates/components/modal.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
{{#uk-modal
visible=visible
on-submit=(action "submit")
on-show=(action (mut visible) true)
on-hide=(action (mut visible) false)
}}
<h2 class="uk-modal-title">Test</h2>
<p>Lorem Ipsum</p>
Expand Down

0 comments on commit 6a3ddef

Please sign in to comment.