1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

fix: add disabled propertu to select

This commit is contained in:
Ivar Conradi Østhus 2020-08-07 11:25:24 +02:00
parent c7cacc183b
commit 5844c488f3

View File

@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
const Select = ({ name, value, label, options, style, onChange, filled }) => { const Select = ({ name, value, label, options, style, onChange, disabled = false, filled }) => {
const wrapper = Object.assign({ width: 'auto' }, style); const wrapper = Object.assign({ width: 'auto' }, style);
return ( return (
<div <div
@ -11,6 +11,7 @@ const Select = ({ name, value, label, options, style, onChange, filled }) => {
<select <select
className="mdl-textfield__input" className="mdl-textfield__input"
name={name} name={name}
disabled={disabled}
onChange={onChange} onChange={onChange}
value={value} value={value}
style={{ width: 'auto', background: filled ? '#f5f5f5' : 'none' }} style={{ width: 'auto', background: filled ? '#f5f5f5' : 'none' }}
@ -35,6 +36,8 @@ Select.propTypes = {
options: PropTypes.array, options: PropTypes.array,
style: PropTypes.object, style: PropTypes.object,
onChange: PropTypes.func.isRequired, onChange: PropTypes.func.isRequired,
disabled: PropTypes.bool,
filled: PropTypes.bool,
}; };
export default Select; export default Select;