From 14c63aebd13b7a5b25ac43a27126fb6e853071a3 Mon Sep 17 00:00:00 2001 From: georgewrmarshall Date: Fri, 19 May 2023 07:38:11 +1200 Subject: [PATCH 1/2] Migrating Label component to TS --- .../label/__snapshots__/label.test.tsx.snap | 11 ++++++ .../component-library/label/index.js | 1 - .../component-library/label/index.ts | 2 ++ .../{label.stories.js => label.stories.tsx} | 25 ++++++------- .../label/{label.test.js => label.test.tsx} | 0 .../component-library/label/label.tsx | 35 +++++++++++++++++++ .../component-library/label/label.types.ts | 16 +++++++++ 7 files changed, 77 insertions(+), 13 deletions(-) create mode 100644 ui/components/component-library/label/__snapshots__/label.test.tsx.snap delete mode 100644 ui/components/component-library/label/index.js create mode 100644 ui/components/component-library/label/index.ts rename ui/components/component-library/label/{label.stories.js => label.stories.tsx} (70%) rename ui/components/component-library/label/{label.test.js => label.test.tsx} (100%) create mode 100644 ui/components/component-library/label/label.tsx create mode 100644 ui/components/component-library/label/label.types.ts diff --git a/ui/components/component-library/label/__snapshots__/label.test.tsx.snap b/ui/components/component-library/label/__snapshots__/label.test.tsx.snap new file mode 100644 index 000000000000..f72fcd1f742d --- /dev/null +++ b/ui/components/component-library/label/__snapshots__/label.test.tsx.snap @@ -0,0 +1,11 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`label should render text inside the label 1`] = ` +
+ +
+`; diff --git a/ui/components/component-library/label/index.js b/ui/components/component-library/label/index.js deleted file mode 100644 index f28365d90fa8..000000000000 --- a/ui/components/component-library/label/index.js +++ /dev/null @@ -1 +0,0 @@ -export { Label } from './label'; diff --git a/ui/components/component-library/label/index.ts b/ui/components/component-library/label/index.ts new file mode 100644 index 000000000000..c2db3927398e --- /dev/null +++ b/ui/components/component-library/label/index.ts @@ -0,0 +1,2 @@ +export { Label } from './label'; +export type { LabelProps } from './label.types'; diff --git a/ui/components/component-library/label/label.stories.js b/ui/components/component-library/label/label.stories.tsx similarity index 70% rename from ui/components/component-library/label/label.stories.js rename to ui/components/component-library/label/label.stories.tsx index 9b6554737cf3..d653db4a1690 100644 --- a/ui/components/component-library/label/label.stories.js +++ b/ui/components/component-library/label/label.stories.tsx @@ -1,7 +1,8 @@ import React, { useState } from 'react'; +import { ComponentMeta, ComponentStory } from '@storybook/react'; import { - DISPLAY, - FLEX_DIRECTION, + Display, + FlexDirection, AlignItems, IconColor, } from '../../../helpers/constants/design-system'; @@ -37,21 +38,21 @@ export default { args: { children: 'Label', }, -}; +} as ComponentMeta; -const Template = (args) =>