diff --git a/packages/grafana-ui/src/components/BarGauge/BarGauge.story.tsx b/packages/grafana-ui/src/components/BarGauge/BarGauge.story.tsx index 6754d43a5cc..455b29f3942 100644 --- a/packages/grafana-ui/src/components/BarGauge/BarGauge.story.tsx +++ b/packages/grafana-ui/src/components/BarGauge/BarGauge.story.tsx @@ -2,7 +2,7 @@ import { storiesOf } from '@storybook/react'; import { number, text, boolean } from '@storybook/addon-knobs'; import { BarGauge } from './BarGauge'; import { VizOrientation } from '../../types'; -import { withCenteredStory } from '../../utils/storybook/withCenteredStory'; +import { withHorizontallyCenteredStory } from '../../utils/storybook/withCenteredStory'; import { renderComponentWithTheme } from '../../utils/storybook/withTheme'; const getKnobs = () => { @@ -23,7 +23,7 @@ const getKnobs = () => { const BarGaugeStories = storiesOf('UI/BarGauge/BarGauge', module); -BarGaugeStories.addDecorator(withCenteredStory); +BarGaugeStories.addDecorator(withHorizontallyCenteredStory); BarGaugeStories.add('Simple with basic thresholds', () => { const { @@ -41,9 +41,9 @@ BarGaugeStories.add('Simple with basic thresholds', () => { } = getKnobs(); return renderComponentWithTheme(BarGauge, { - width: 700, - height: 700, - value: value, + width: 300, + height: 300, + value: { text: value.toString(), numeric: value }, minValue: minValue, maxValue: maxValue, unit: unit, diff --git a/packages/grafana-ui/src/utils/storybook/withCenteredStory.tsx b/packages/grafana-ui/src/utils/storybook/withCenteredStory.tsx index af564616f5a..abd4b6b3506 100644 --- a/packages/grafana-ui/src/utils/storybook/withCenteredStory.tsx +++ b/packages/grafana-ui/src/utils/storybook/withCenteredStory.tsx @@ -1,14 +1,20 @@ import React from 'react'; import { RenderFunction } from '@storybook/react'; -const CenteredStory: React.FunctionComponent<{}> = ({ children }) => { +interface CenteredStoryProps { + children: React.ReactNode; + horizontal?: boolean; + vertical?: boolean; +} +const CenteredStory: React.FunctionComponent = ({ horizontal, vertical, children }) => { return (
{children} @@ -16,4 +22,13 @@ const CenteredStory: React.FunctionComponent<{}> = ({ children }) => { ); }; -export const withCenteredStory = (story: RenderFunction) => {story()}; +export const withNotCenteredStory = (story: RenderFunction) => {story()}; +export const withCenteredStory = (story: RenderFunction) => ( + + {story()} + +); +export const withHorizontallyCenteredStory = (story: RenderFunction) => ( + {story()} +); +export const withVerticallyCenteredStory = (story: RenderFunction) => {story()}; diff --git a/packages/grafana-ui/src/utils/storybook/withPaddedStory.tsx b/packages/grafana-ui/src/utils/storybook/withPaddedStory.tsx index dfe1b97a63b..23036e59d8a 100644 --- a/packages/grafana-ui/src/utils/storybook/withPaddedStory.tsx +++ b/packages/grafana-ui/src/utils/storybook/withPaddedStory.tsx @@ -5,7 +5,10 @@ const PaddedStory: React.FunctionComponent<{}> = ({ children }) => { return (
{children}