Skip to content

Instantly share code, notes, and snippets.

@KTruong008
Created September 17, 2017 22:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KTruong008/8ced34678b849d9c17a7732fca4ca1d0 to your computer and use it in GitHub Desktop.
Save KTruong008/8ced34678b849d9c17a7732fca4ca1d0 to your computer and use it in GitHub Desktop.
import React from 'react';
export const Select = props => {
const renderSelectOptions = (key, index) => {
return (
<option
key={`${index}-${key}`}
value={key}
>
{props.options[key]}
</option>
);
}
if (props && props.options) {
return (
<div className="mv3 w-100">
<div className="b sans-serif pv2 w-100">{props.label}</div>
<select {...props.input} className="pa2 input-reset ba b--black-40 w-100">
<option value="">Select</option>
{Object.keys(props.options).map(renderSelectOptions)}
</select>
</div>
)
}
return <div></div>
}
export default Select;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment