mirror of
https://github.com/flarum/framework.git
synced 2025-03-31 04:15:15 +08:00
18 lines
401 B
JavaScript
18 lines
401 B
JavaScript
import Checkbox from './Checkbox';
|
|
|
|
/**
|
|
* The `Switch` component is a `Checkbox`, but with a switch display instead of
|
|
* a tick/cross one.
|
|
*/
|
|
export default class Switch extends Checkbox {
|
|
static initAttrs(attrs) {
|
|
super.initAttrs(attrs);
|
|
|
|
attrs.className = (attrs.className || '') + ' Checkbox--switch';
|
|
}
|
|
|
|
getDisplay() {
|
|
return !!this.attrs.loading && super.getDisplay();
|
|
}
|
|
}
|