Skip to content

Instantly share code, notes, and snippets.

@rrharvey
Created May 24, 2017 13:24
Show Gist options
  • Save rrharvey/cc62037df56e635cba6a62bea48d7500 to your computer and use it in GitHub Desktop.
Save rrharvey/cc62037df56e635cba6a62bea48d7500 to your computer and use it in GitHub Desktop.
Dropdown.tsx
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