Last active
October 21, 2019 05:03
-
-
Save ferrannp/63cd431654798c53e6aa72adf5a4caea to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const Dropdown = (props) => ( | |
<div className='dropdown'> | |
<button onClick={props.onToggle}> | |
Selected option: {props.data[props.optionSelected]} | |
</button> | |
<ul className={props.isOpen ? 'active':null}> | |
{ | |
props.data.map((item, i) => { | |
return ( | |
<li key={i} className={i === props.optionSelected ? 'selected':null} | |
onClick={() => props.onSelect(i)}> | |
{item} | |
</li> | |
) | |
}) | |
} | |
</ul> | |
</div> | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment