From 8975cc421e379a0c0f3e1fc6c03c117425c3ef16 Mon Sep 17 00:00:00 2001 From: Adam Dobrawy Date: Thu, 20 Jan 2022 03:05:26 +0100 Subject: [PATCH] Migrate Checkbox story to tsx - see #18100 --- .../{Checkbox.stories.jsx => Checkbox.stories.tsx} | 7 +++---- superset-frontend/src/components/Checkbox/Checkbox.tsx | 2 ++ superset-frontend/src/components/Checkbox/index.tsx | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) rename superset-frontend/src/components/Checkbox/{Checkbox.stories.jsx => Checkbox.stories.tsx} (90%) diff --git a/superset-frontend/src/components/Checkbox/Checkbox.stories.jsx b/superset-frontend/src/components/Checkbox/Checkbox.stories.tsx similarity index 90% rename from superset-frontend/src/components/Checkbox/Checkbox.stories.jsx rename to superset-frontend/src/components/Checkbox/Checkbox.stories.tsx index a9790a3e9527b..64b29140e4a48 100644 --- a/superset-frontend/src/components/Checkbox/Checkbox.stories.jsx +++ b/superset-frontend/src/components/Checkbox/Checkbox.stories.tsx @@ -18,7 +18,7 @@ */ import React from 'react'; import { useArgs } from '@storybook/client-api'; -import Checkbox from '.'; +import Checkbox, { CheckboxProps } from '.'; export default { title: 'Checkbox', @@ -42,9 +42,8 @@ export const CheckboxGallery = () => )); -// eslint-disable-next-line no-unused-vars -export const InteractiveCheckbox = _args => { - const [{ checked, style }, updateArgs] = useArgs(); +export const InteractiveCheckbox = ({ checked, style }: CheckboxProps) => { + const [, updateArgs] = useArgs(); const toggleCheckbox = () => { updateArgs({ checked: !checked }); }; diff --git a/superset-frontend/src/components/Checkbox/Checkbox.tsx b/superset-frontend/src/components/Checkbox/Checkbox.tsx index 8a7f7e06d377c..a256677be6164 100644 --- a/superset-frontend/src/components/Checkbox/Checkbox.tsx +++ b/superset-frontend/src/components/Checkbox/Checkbox.tsx @@ -49,3 +49,5 @@ export default function Checkbox({ checked, onChange, style }: CheckboxProps) { ); } + +export type { CheckboxProps }; diff --git a/superset-frontend/src/components/Checkbox/index.tsx b/superset-frontend/src/components/Checkbox/index.tsx index 930c37c11c5d2..c9dc652b58ac7 100644 --- a/superset-frontend/src/components/Checkbox/index.tsx +++ b/superset-frontend/src/components/Checkbox/index.tsx @@ -16,5 +16,5 @@ * specific language governing permissions and limitations * under the License. */ -export { default } from 'src/components/Checkbox/Checkbox'; +export { default, CheckboxProps } from 'src/components/Checkbox/Checkbox'; export * from 'src/components/Checkbox/CheckboxIcons';