ohif-viewer/platform/ui/src/elements/form/OldSelect.js
Danny Brown 0d21cc6ad0
fix: MIP styling (#1109)
* Try to restore previous select component as new component

* fix issue where background is gray in download panel
2019-10-27 23:10:20 -04:00

50 lines
1014 B
JavaScript

import './Select.css';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
class Select extends Component {
constructor(props) {
super(props);
this.state = {
value: this.props.value,
};
}
handleChange = event => {
const value = event.target.value;
this.setState({ value });
if (this.props.onChange) this.props.onChange(value);
};
render() {
return (
<select
className="select-ohif"
value={this.state.selected}
onChange={this.handleChange}
>
{this.props.options.map(({ key, value }) => {
return (
<option key={key} value={value}>
{key}
</option>
);
})}
</select>
);
}
}
Select.propTypes = {
options: PropTypes.arrayOf(
PropTypes.shape({
key: PropTypes.string.isRequired,
value: PropTypes.string.isRequired,
})
),
value: PropTypes.string,
onChange: PropTypes.func,
};
export default Select;