mirror of
https://github.com/flarum/core.git
synced 2025-05-10 17:35:25 +02:00
- Use JSX for templates - Docblock/comment everything - Mostly passes ESLint (still some work to do) - Lots of renaming, refactoring, etc. CSS hasn't been updated yet.
28 lines
716 B
JavaScript
28 lines
716 B
JavaScript
import Component from 'flarum/Component';
|
|
|
|
/**
|
|
* The `LoadingIndicator` component displays a loading spinner with spin.js. It
|
|
* may have the following special props:
|
|
*
|
|
* - `size` The spin.js size preset to use. Defaults to 'small'.
|
|
*
|
|
* All other props will be assigned as attributes on the element.
|
|
*/
|
|
export default class LoadingIndicator extends Component {
|
|
view() {
|
|
const attrs = Object.assign({}, this.props);
|
|
|
|
attrs.className = 'loading-indicator ' + (attrs.className || '');
|
|
delete attrs.size;
|
|
|
|
return <div {...attrs}>{m.trust(' ')}</div>;
|
|
}
|
|
|
|
config() {
|
|
const size = this.props.size || 'small';
|
|
|
|
$.fn.spin.presets[size].zIndex = 'auto';
|
|
this.$().spin(size);
|
|
}
|
|
}
|