1import React from 'react';
2import PropTypes from 'prop-types';
4import { DropdownItem, DropdownDivider } from './Base';
6class InnerLabelDropdown extends React.Component {
14 this.toggle = this.toggle.bind(this);
15 this.close = this.close.bind(this);
20 isOpen: !this.state.isOpen,
32 this.props.handleUpdate(opt);
36 return this.props.options.map((opt, i) => {
37 if (opt.type === 'divider') {
38 return <DropdownDivider key={`divider-${i}`} />;
43 onClick={() => this.selectOption(opt.value)}>
52 const { props, state } = this;
54 const optionElems = this.getOptionElems();
56 const menuVisibility = state.isOpen === true ? 'visible' : 'hidden';
58 const selectedClasses = state.isOpen === true ? 'br-blue' : 'br-gray-50';
60 const fullWidthClass = props.fullWidth ? 'full-width' : '';
63 <div className={`rel table ${fullWidthClass} ${props.className}`}>
65 className={`fix full o-0 ${menuVisibility}`}
70 className={`h-10 mp-0 bg-white outline-blue sans ${fullWidthClass}`}
72 disabled={props.disabled}>
73 <div className={'flex'}>
75 className={`ph-4 flex align-center b-2 br-0 b-solid h-10 ${selectedClasses} ${fullWidthClass}`}>
76 <div className={'text-400 mr-2'}>{props.title}</div>
77 <div className={'text-600'}>{props.currentSelectionTitle}</div>
79 <div className={'white bg-blue s-10 flex-center-all text-sm'}>
86 className={`abs flex-column bg-white t-12 l-0 w-100 z-1 ${menuVisibility}`}>
87 <div className={'pv-1 b-solid b-gray-50 b-2 bb-0'} />
91 <div className={'pv-1 b-solid b-gray-50 b-2 bt-0'} />
98InnerLabelDropdown.propTypes = {
99 disabled: PropTypes.bool,
100 className: PropTypes.string,
101 title: PropTypes.string,
102 style: PropTypes.object,
103 currentSelectionTitle: PropTypes.string,
104 children: PropTypes.node,
107InnerLabelDropdown.defaultProps = {
112 currentSelectionTitle: '',
115export default InnerLabelDropdown;
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list