From af12e6d20e83fc7e6080e9aa71ea13e2bb0eb1ea Mon Sep 17 00:00:00 2001 From: Uchechukwu Obasi Date: Tue, 23 Feb 2021 15:20:07 +0100 Subject: [PATCH] Move NOOP_CONTROL to storybook utils and change to a standalone file (#31421) --- packages/grafana-ui/.storybook/preview.ts | 2 -- .../src/components/BarGauge/BarGauge.story.tsx | 2 +- .../src/components/BigValue/BigValue.story.tsx | 2 +- .../components/ButtonCascader/ButtonCascader.story.tsx | 2 +- .../CallToActionCard.story.internal.tsx | 2 +- .../src/components/Cascader/Cascader.story.tsx | 2 +- .../grafana-ui/src/utils/storybook/noopControl.tsx | 1 + packages/grafana-ui/tsconfig.build.json | 10 +--------- 8 files changed, 7 insertions(+), 16 deletions(-) create mode 100644 packages/grafana-ui/src/utils/storybook/noopControl.tsx diff --git a/packages/grafana-ui/.storybook/preview.ts b/packages/grafana-ui/.storybook/preview.ts index 50efa10cb74..9e40a52a344 100644 --- a/packages/grafana-ui/.storybook/preview.ts +++ b/packages/grafana-ui/.storybook/preview.ts @@ -59,5 +59,3 @@ export const parameters = { escapeHTML: false, }, }; - -export const NOOP_CONTROL = { control: { disable: true } }; diff --git a/packages/grafana-ui/src/components/BarGauge/BarGauge.story.tsx b/packages/grafana-ui/src/components/BarGauge/BarGauge.story.tsx index 6349d680fb2..622a9220320 100644 --- a/packages/grafana-ui/src/components/BarGauge/BarGauge.story.tsx +++ b/packages/grafana-ui/src/components/BarGauge/BarGauge.story.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { Story } from '@storybook/react'; import { BarGauge, BarGaugeDisplayMode } from '@grafana/ui'; -import { NOOP_CONTROL } from '@grafana/ui/.storybook/preview'; +import { NOOP_CONTROL } from '../../utils/storybook/noopControl'; import { VizOrientation, ThresholdsMode, Field, FieldType, getDisplayProcessor } from '@grafana/data'; import { Props } from './BarGauge'; import { withCenteredStory } from '../../utils/storybook/withCenteredStory'; diff --git a/packages/grafana-ui/src/components/BigValue/BigValue.story.tsx b/packages/grafana-ui/src/components/BigValue/BigValue.story.tsx index c74e9a82d70..88e014298fc 100644 --- a/packages/grafana-ui/src/components/BigValue/BigValue.story.tsx +++ b/packages/grafana-ui/src/components/BigValue/BigValue.story.tsx @@ -11,7 +11,7 @@ import { import { withCenteredStory } from '../../utils/storybook/withCenteredStory'; import mdx from './BigValue.mdx'; import { useTheme } from '../../themes'; -import { NOOP_CONTROL } from '@grafana/ui/.storybook/preview'; +import { NOOP_CONTROL } from '../../utils/storybook/noopControl'; import { ArrayVector, FieldSparkline, FieldType } from '@grafana/data'; export default { diff --git a/packages/grafana-ui/src/components/ButtonCascader/ButtonCascader.story.tsx b/packages/grafana-ui/src/components/ButtonCascader/ButtonCascader.story.tsx index 2ff6f650f12..3652335f8eb 100644 --- a/packages/grafana-ui/src/components/ButtonCascader/ButtonCascader.story.tsx +++ b/packages/grafana-ui/src/components/ButtonCascader/ButtonCascader.story.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { Story } from '@storybook/react'; import { withCenteredStory } from '../../utils/storybook/withCenteredStory'; import { ButtonCascader } from '@grafana/ui'; -import { NOOP_CONTROL } from '@grafana/ui/.storybook/preview'; +import { NOOP_CONTROL } from '../../utils/storybook/noopControl'; import { ButtonCascaderProps } from './ButtonCascader'; export default { diff --git a/packages/grafana-ui/src/components/CallToActionCard/CallToActionCard.story.internal.tsx b/packages/grafana-ui/src/components/CallToActionCard/CallToActionCard.story.internal.tsx index 37f9d16b13b..f5ccd36b88b 100644 --- a/packages/grafana-ui/src/components/CallToActionCard/CallToActionCard.story.internal.tsx +++ b/packages/grafana-ui/src/components/CallToActionCard/CallToActionCard.story.internal.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { renderComponentWithTheme } from '../../utils/storybook/withTheme'; import { CallToActionCard, CallToActionCardProps } from './CallToActionCard'; -import { NOOP_CONTROL } from '../../../.storybook/preview'; +import { NOOP_CONTROL } from '../../utils/storybook/noopControl'; import { Story } from '@storybook/react'; import { Button } from '../Button/Button'; import { action } from '@storybook/addon-actions'; diff --git a/packages/grafana-ui/src/components/Cascader/Cascader.story.tsx b/packages/grafana-ui/src/components/Cascader/Cascader.story.tsx index f62024862f8..53fbc46cc73 100644 --- a/packages/grafana-ui/src/components/Cascader/Cascader.story.tsx +++ b/packages/grafana-ui/src/components/Cascader/Cascader.story.tsx @@ -1,6 +1,6 @@ import { Story } from '@storybook/react'; import { withCenteredStory } from '../../utils/storybook/withCenteredStory'; -import { NOOP_CONTROL } from '../../../.storybook/preview'; +import { NOOP_CONTROL } from '../../utils/storybook/noopControl'; import { Cascader } from '@grafana/ui'; import { CascaderProps } from './Cascader'; import mdx from './Cascader.mdx'; diff --git a/packages/grafana-ui/src/utils/storybook/noopControl.tsx b/packages/grafana-ui/src/utils/storybook/noopControl.tsx new file mode 100644 index 00000000000..d433da2c904 --- /dev/null +++ b/packages/grafana-ui/src/utils/storybook/noopControl.tsx @@ -0,0 +1 @@ +export const NOOP_CONTROL = { control: { disable: true } }; diff --git a/packages/grafana-ui/tsconfig.build.json b/packages/grafana-ui/tsconfig.build.json index fefe5556971..6134388bd9d 100644 --- a/packages/grafana-ui/tsconfig.build.json +++ b/packages/grafana-ui/tsconfig.build.json @@ -1,12 +1,4 @@ { - "exclude": [ - "**/*.story.tsx", - "**/*.story.internal.tsx", - "**/*.test.ts*", - "**/*.tmpl.ts", - "dist", - "node_modules", - "src/utils/storybook" - ], + "exclude": ["**/*.story.tsx", "**/*.test.ts*", "**/*.tmpl.ts", "dist", "node_modules", "src/utils/storybook"], "extends": "./tsconfig.json" }