diff --git a/public/app/core/components/Picker/UnitPicker.tsx b/public/app/core/components/Picker/UnitPicker.tsx new file mode 100644 index 00000000000..3983f0842c9 --- /dev/null +++ b/public/app/core/components/Picker/UnitPicker.tsx @@ -0,0 +1,68 @@ +import React, { PureComponent } from 'react'; +import Select from 'react-select'; +import ResetStyles from 'app/core/components/Picker/ResetStyles'; +import DescriptionOption from './DescriptionOption'; +import kbn from '../../utils/kbn'; + +interface Props { + width: number; + className?: string; + onSelected: (item: any) => {} | void; + placeholder?: string; +} + +export class UnitPicker extends PureComponent { + formatGroupLabel = data => { + console.log('format', data); + + const groupStyles = { + display: 'flex', + alignItems: 'center', + justifyContent: 'space-between', + }; + + const groupBadgeStyles = { + backgroundColor: '#EBECF0', + borderRadius: '2em', + color: '#172B4D', + display: 'inline-block', + fontSize: 12, + fontWeight: 400, + lineHeight: '1', + minWidth: 1, + padding: '0.16666666666667em 0.5em', + textAlign: 'center', + } as React.CSSProperties; + + return ( +
+ {data.label} + {data.submenu.length} +
+ ); + }; + + render() { + const { className, onSelected, placeholder, width } = this.props; + + const options = kbn.getUnitFormats(); + + return ( +