From 61e952bad022e6bde0228c2c6a54d55f5cecd3bc Mon Sep 17 00:00:00 2001 From: Dhruv <79097544+dhruvv173@users.noreply.github.com> Date: Mon, 5 Jun 2023 21:25:20 +0530 Subject: [PATCH] Replacing deprecated constants with enums (#19242) --- .../avatar-base/avatar-base.stories.tsx | 4 +- .../component-library/text/text.stories.tsx | 42 +++++++++---------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/ui/components/component-library/avatar-base/avatar-base.stories.tsx b/ui/components/component-library/avatar-base/avatar-base.stories.tsx index c72988922..74a25c603 100644 --- a/ui/components/component-library/avatar-base/avatar-base.stories.tsx +++ b/ui/components/component-library/avatar-base/avatar-base.stories.tsx @@ -1,4 +1,4 @@ -import { ComponentMeta } from '@storybook/react'; +import { Meta } from '@storybook/react'; import React from 'react'; import { AlignItems, @@ -92,7 +92,7 @@ export default { borderColor: BorderColor.borderDefault, children: 'B', }, -} as ComponentMeta; +} as Meta; export const DefaultStory = (args: AvatarBaseProps) => ; diff --git a/ui/components/component-library/text/text.stories.tsx b/ui/components/component-library/text/text.stories.tsx index 3ece16787..965348d67 100644 --- a/ui/components/component-library/text/text.stories.tsx +++ b/ui/components/component-library/text/text.stories.tsx @@ -1,7 +1,7 @@ import React from 'react'; -import { ComponentStory, ComponentMeta } from '@storybook/react'; +import { StoryFn, Meta } from '@storybook/react'; import { - DISPLAY, + Display, BackgroundColor, BorderColor, FontWeight, @@ -10,8 +10,8 @@ import { TextAlign, OverflowWrap, TextTransform, - FRACTIONS, - FLEX_DIRECTION, + BlockSize, + FlexDirection, TextVariant, Color, } from '../../../helpers/constants/design-system'; @@ -30,7 +30,7 @@ export default { page: README, }, }, -} as ComponentMeta; +} as Meta; function renderBackgroundColor(color) { let bgColor; @@ -70,7 +70,7 @@ function renderBackgroundColor(color) { return bgColor; } -const Template: ComponentStory = (args) => ( +const Template: StoryFn = (args) => ( {args.children} ); @@ -92,7 +92,7 @@ export const Variant = (args) => ( ); -export const ColorStory: ComponentStory = (args) => { +export const ColorStory: StoryFn = (args) => { // Index of last valid color in TextColor array return ( <> @@ -113,7 +113,7 @@ export const ColorStory: ComponentStory = (args) => { }; ColorStory.storyName = 'Color'; -export const FontWeightStory: ComponentStory = (args) => ( +export const FontWeightStory: StoryFn = (args) => ( <> {Object.values(FontWeight).map((weight) => ( @@ -125,7 +125,7 @@ export const FontWeightStory: ComponentStory = (args) => ( FontWeightStory.storyName = 'Font Weight'; -export const FontStyleStory: ComponentStory = (args) => ( +export const FontStyleStory: StoryFn = (args) => ( <> {Object.values(FontStyle).map((style) => ( @@ -137,7 +137,7 @@ export const FontStyleStory: ComponentStory = (args) => ( FontStyleStory.storyName = 'Font Style'; -export const TextTransformStory: ComponentStory = (args) => ( +export const TextTransformStory: StoryFn = (args) => ( <> {Object.values(TextTransform).map((transform) => ( @@ -149,7 +149,7 @@ export const TextTransformStory: ComponentStory = (args) => ( TextTransformStory.storyName = 'Text Transform'; -export const TextAlignStory: ComponentStory = (args) => ( +export const TextAlignStory: StoryFn = (args) => ( <> {Object.values(TextAlign).map((align) => ( @@ -161,10 +161,10 @@ export const TextAlignStory: ComponentStory = (args) => ( TextAlignStory.storyName = 'Text Align'; -export const OverflowWrapStory: ComponentStory = (args) => ( +export const OverflowWrapStory: StoryFn = (args) => ( @@ -178,11 +178,11 @@ export const OverflowWrapStory: ComponentStory = (args) => ( OverflowWrapStory.storyName = 'Overflow Wrap'; -export const Ellipsis: ComponentStory = (args) => ( +export const Ellipsis: StoryFn = (args) => ( Ellipsis: 0x39013f961c378f02c2b82a6e1d31e9812786fd9d @@ -193,7 +193,7 @@ export const Ellipsis: ComponentStory = (args) => ( ); -export const As: ComponentStory = (args) => ( +export const As: StoryFn = (args) => ( <> {Object.keys(ValidTag).map((tag) => { if (ValidTag[tag] === ValidTag.Input) { @@ -217,11 +217,11 @@ export const As: ComponentStory = (args) => ( ); -export const TextDirectionStory: ComponentStory = (args) => ( +export const TextDirectionStory: StoryFn = (args) => ( @@ -237,7 +237,7 @@ export const TextDirectionStory: ComponentStory = (args) => ( ); -export const Strong: ComponentStory = (args) => ( +export const Strong: StoryFn = (args) => ( <> This is an as="strong" demo.