mirror of
https://github.com/flarum/core.git
synced 2025-08-08 09:26:34 +02:00
update: common/components/Select
This commit is contained in:
committed by
Franz Liedke
parent
4d45aaa9ae
commit
537f5e833e
@@ -1,9 +1,10 @@
|
|||||||
import Component from '../Component';
|
import Component from '../Component';
|
||||||
import icon from '../helpers/icon';
|
import icon from '../helpers/icon';
|
||||||
|
import withAttr from '../utils/withAttr';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The `Select` component displays a <select> input, surrounded with some extra
|
* The `Select` component displays a <select> input, surrounded with some extra
|
||||||
* elements for styling. It accepts the following props:
|
* elements for styling. It accepts the following attrs:
|
||||||
*
|
*
|
||||||
* - `options` A map of option values to labels.
|
* - `options` A map of option values to labels.
|
||||||
* - `onchange` A callback to run when the selected value is changed.
|
* - `onchange` A callback to run when the selected value is changed.
|
||||||
@@ -12,13 +13,13 @@ import icon from '../helpers/icon';
|
|||||||
*/
|
*/
|
||||||
export default class Select extends Component {
|
export default class Select extends Component {
|
||||||
view() {
|
view() {
|
||||||
const { options, onchange, value, disabled } = this.props;
|
const { options, onchange, value, disabled } = this.attrs;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<span className="Select">
|
<span className="Select">
|
||||||
<select
|
<select
|
||||||
className="Select-input FormControl"
|
className="Select-input FormControl"
|
||||||
onchange={onchange ? m.withAttr('value', onchange.bind(this)) : undefined}
|
onchange={onchange ? withAttr('value', onchange.bind(this)) : undefined}
|
||||||
value={value}
|
value={value}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
>
|
>
|
||||||
|
Reference in New Issue
Block a user