Created
April 27, 2020 11:58
-
-
Save marshallmurphy/42ba08176ce7c0b403a1d551dd95cc10 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, { useState } from 'react'; | |
import styles from './dropdown.module.css'; | |
const Dropdown = () => { | |
const [active, setActive] = useState(false); | |
return ( | |
<div className={styles.dropdown}> | |
<button onClick={() => setActive(!active)}> | |
Dropdown | |
<div className={styles.caretDown}>^</div> | |
</button> | |
{active && ( | |
<div className={styles.menu}> | |
<div tabIndex='0' className={styles.menuItem}>Item A</div> | |
<div tabIndex='0' className={styles.menuItem}>Item B</div> | |
<div tabIndex='0' className={styles.menuItem}>Item C</div> | |
</div> | |
)} | |
</div> | |
) | |
} | |
export default Dropdown; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment