From 9b483e765bed89d44cfd71d9ca42edf746a62c76 Mon Sep 17 00:00:00 2001 From: Andrej Ocenas Date: Wed, 9 Oct 2019 14:11:45 +0200 Subject: [PATCH] UX: Fix empty space in select (#19713) --- .../src/components/Select/Select.story.tsx | 38 ++++++++++++++ .../src/components/Select/SingleValue.tsx | 36 +++++++++---- packages/grafana-ui/src/components/index.ts | 2 +- .../transitions/SlideOutTransition.tsx | 50 +++++++++++++++++++ .../__snapshots__/QueryEditor.test.tsx.snap | 3 -- 5 files changed, 115 insertions(+), 14 deletions(-) create mode 100644 packages/grafana-ui/src/components/Select/Select.story.tsx create mode 100644 packages/grafana-ui/src/components/transitions/SlideOutTransition.tsx diff --git a/packages/grafana-ui/src/components/Select/Select.story.tsx b/packages/grafana-ui/src/components/Select/Select.story.tsx new file mode 100644 index 00000000000..27601611c5d --- /dev/null +++ b/packages/grafana-ui/src/components/Select/Select.story.tsx @@ -0,0 +1,38 @@ +import React from 'react'; +import { storiesOf } from '@storybook/react'; +import { action } from '@storybook/addon-actions'; +import { withKnobs, object } from '@storybook/addon-knobs'; +import { withCenteredStory } from '../../utils/storybook/withCenteredStory'; +import { UseState } from '../../utils/storybook/UseState'; +import { SelectableValue } from '@grafana/data'; +import { Select } from './Select'; + +const SelectStories = storiesOf('UI/Select/Select', module); + +SelectStories.addDecorator(withCenteredStory).addDecorator(withKnobs); + +SelectStories.add('default', () => { + const intialState: SelectableValue = { label: 'A label', value: 'A value' }; + const value = object>('Selected Value:', intialState); + const options = object>>('Options:', [ + intialState, + { label: 'Another label', value: 'Another value' }, + ]); + + return ( + + {(value, updateValue) => { + return ( +