Created
May 24, 2017 13:24
-
-
Save rrharvey/cc62037df56e635cba6a62bea48d7500 to your computer and use it in GitHub Desktop.
Dropdown.tsx
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
import * as React from 'react'; | |
import * as classNames from 'classnames'; | |
interface DropdownProps { | |
text: string; | |
rightAlign?: boolean; | |
} | |
class Dropdown extends React.Component<DropdownProps, null> { | |
constructor() { | |
super(); | |
} | |
render() { | |
const { text, rightAlign } = this.props; | |
return ( | |
<div className="dropdown"> | |
<button type="button" | |
className="btn btn-default dropdown-toggle" | |
> | |
{text} <span className="caret" /> | |
</button> | |
<ul className={classNames('dropdown-menu', { 'dropdown-menu-right': rightAlign })}> | |
<li><a href="#">Action</a></li> | |
<li><a href="#">Another action</a></li> | |
<li><a href="#">Something else here</a></li> | |
<li role="separator" className="divider" /> | |
<li><a href="#">Separated link</a></li> | |
</ul> | |
</div> | |
); | |
} | |
} | |
export default Dropdown; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment