-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1436c8c
commit 661bd6f
Showing
8 changed files
with
84 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,5 @@ | ||
<div class="flash-list" aria-live="assertive" ...attributes> | ||
<div class="w-full flex flex-col items-start justify-start"> | ||
{{#each this.notifications.queue as |notification|}} | ||
<FlashNotification | ||
class={{notification.type}} | ||
@notification={{notification}} | ||
@onClose={{this.removeNotification}} | ||
/> | ||
{{/each}} | ||
{{yield this.notifications}} | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
16 changes: 9 additions & 7 deletions
16
tests/dummy/app/modifiers/toggle-popover.js → tests/dummy/app/modifiers/show-popover.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,34 @@ | ||
import Modifier from 'ember-modifier'; | ||
import { cancel, later } from '@ember/runloop'; | ||
import { inject as service } from '@ember/service'; | ||
import { registerDestructor } from '@ember/destroyable'; | ||
|
||
const cleanup = function (instance) { | ||
cancel(instance.closeTask); | ||
}; | ||
|
||
export default class ShowPopover extends Modifier { | ||
@service notifications; | ||
|
||
constructor() { | ||
super(...arguments); | ||
registerDestructor(this, cleanup); | ||
} | ||
|
||
modify(element) { | ||
// eslint-disable-next-line no-empty-pattern | ||
modify(element, [], { duration = 0 }) { | ||
element.showPopover(); | ||
this.closeTask = this.autoClose(element); | ||
this.closeTask = this.autoClose(element, duration); | ||
} | ||
|
||
autoClose(element) { | ||
autoClose(element, duration) { | ||
return later( | ||
this, | ||
function () { | ||
if (!duration) { | ||
return; | ||
} | ||
|
||
element.hidePopover(); | ||
}, | ||
this.notifications.duration, | ||
duration, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters