mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 03:44:29 +03:00
Converted <GhLoadingSpinner>
to glimmer component
no issue - allows for attributes such as class/style to be set on it's container for better display in varying situations
This commit is contained in:
parent
5a048c105e
commit
342d9a242c
@ -1,5 +1,5 @@
|
||||
{{#if this.showSpinner}}
|
||||
<div class="gh-loading-content">
|
||||
<div class="gh-loading-content" ...attributes>
|
||||
<div class="gh-loading-spinner"></div>
|
||||
</div>
|
||||
{{/if}}
|
@ -1,21 +1,23 @@
|
||||
import Component from '@ember/component';
|
||||
import {task, timeout} from 'ember-concurrency';
|
||||
import Component from '@glimmer/component';
|
||||
import {task} from 'ember-concurrency-decorators';
|
||||
import {timeout} from 'ember-concurrency';
|
||||
import {tracked} from '@glimmer/tracking';
|
||||
|
||||
export default Component.extend({
|
||||
tagName: '',
|
||||
export default class GhLoadingSpinnerComponent extends Component {
|
||||
@tracked showSpinner = false;
|
||||
|
||||
showSpinner: false,
|
||||
// ms until the loader is displayed,
|
||||
// prevents unnecessary flash of spinner
|
||||
slowLoadTimeout: 200,
|
||||
slowLoadTimeout = 200;
|
||||
|
||||
didInsertElement() {
|
||||
this._super(...arguments);
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.startSpinnerTimeout.perform();
|
||||
},
|
||||
}
|
||||
|
||||
startSpinnerTimeout: task(function* () {
|
||||
@task
|
||||
*startSpinnerTimeout() {
|
||||
yield timeout(this.slowLoadTimeout);
|
||||
this.set('showSpinner', true);
|
||||
})
|
||||
});
|
||||
this.showSpinner = true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user