Skip to content

Commit

Permalink
key and value for select knob match key/value of options
Browse files Browse the repository at this point in the history
fixes #799
  • Loading branch information
psimyn committed Jul 9, 2017
1 parent fa75121 commit 597827d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions addons/knobs/src/components/types/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,19 @@ const styles = {
};

class SelectType extends React.Component {
_makeOpt(key, val) {
_makeOpt(key, value) {
const opts = {
key,
value: key,
value,
};

return (
<option {...opts}>
{val}
{key}
</option>
);
}

_options(values) {
let data = [];
if (Array.isArray(values)) {
Expand Down Expand Up @@ -68,6 +69,7 @@ SelectType.propTypes = {
knob: PropTypes.shape({
name: PropTypes.string,
value: PropTypes.string,
options: PropTypes.oneOfType([PropTypes.array, PropTypes.object]),
}),
onChange: PropTypes.func,
};
Expand Down

0 comments on commit 597827d

Please sign in to comment.