-
-
Save KTruong008/8ced34678b849d9c17a7732fca4ca1d0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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