From 063a1acf9438dbfe7511c812105682630510b5f5 Mon Sep 17 00:00:00 2001 From: Peter Holmberg Date: Wed, 14 Nov 2018 17:00:26 +0100 Subject: [PATCH] started on options and groups --- .../app/core/components/Picker/UnitPicker.tsx | 45 +- public/app/core/utils/kbn.ts | 424 +++++++++--------- public/app/plugins/panel/gauge/module.tsx | 2 +- 3 files changed, 239 insertions(+), 232 deletions(-) diff --git a/public/app/core/components/Picker/UnitPicker.tsx b/public/app/core/components/Picker/UnitPicker.tsx index 3983f0842c9..54bfb2e208f 100644 --- a/public/app/core/components/Picker/UnitPicker.tsx +++ b/public/app/core/components/Picker/UnitPicker.tsx @@ -1,25 +1,22 @@ import React, { PureComponent } from 'react'; -import Select from 'react-select'; +import Select, { components } 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 = { + margin: '0 15px', + fontSize: '16px', + fontWeight: 700, display: 'flex', alignItems: 'center', justifyContent: 'space-between', - }; + } as React.CSSProperties; const groupBadgeStyles = { backgroundColor: '#EBECF0', @@ -37,29 +34,39 @@ export class UnitPicker extends PureComponent { return (
{data.label} - {data.submenu.length} + {data.options.length}
); }; - render() { - const { className, onSelected, placeholder, width } = this.props; + renderOption = props => { + return ( + +
+
{props.children}
+
+
+ ); + }; + renderGroup = props => { + return ; + }; + + render() { const options = kbn.getUnitFormats(); return (