From 7084b9fad029149191e7c6f987d11da822df5ce1 Mon Sep 17 00:00:00 2001 From: "Valentin D. Pinkman" Date: Mon, 25 Sep 2023 15:39:54 +0200 Subject: [PATCH] chore: fix ui libs types --- .../stories/ChartCard/ChartCard.stories.tsx | 2 +- .../stories/Form/Input/BaseInput.stories.tsx | 1 + .../react/src/components/Table/Table.stories.tsx | 4 ++-- .../src/components/form/BaseInput/Input.stories.tsx | 1 + .../VerticalTimeline/VerticalTimeline.stories.tsx | 13 ++++++++++++- .../navigation/Breadcrumb/Breadcrumb.stories.tsx | 2 +- .../react/src/components/tabs/Tabs/index.tsx | 2 +- 7 files changed, 19 insertions(+), 6 deletions(-) diff --git a/libs/ui/packages/native/storybook/stories/ChartCard/ChartCard.stories.tsx b/libs/ui/packages/native/storybook/stories/ChartCard/ChartCard.stories.tsx index 375522df3a73..c7a718fede1a 100644 --- a/libs/ui/packages/native/storybook/stories/ChartCard/ChartCard.stories.tsx +++ b/libs/ui/packages/native/storybook/stories/ChartCard/ChartCard.stories.tsx @@ -42,7 +42,7 @@ export const ChartCardDefault = (args: typeof ChartCardDefaultArgs): JSX.Element const [rangeRequest, setRangeRequest] = useState("24h"); const refreshChart = useCallback( - (request) => { + (request: any) => { if (request && request.range) { const { range } = request; setRangeRequest(range); diff --git a/libs/ui/packages/native/storybook/stories/Form/Input/BaseInput.stories.tsx b/libs/ui/packages/native/storybook/stories/Form/Input/BaseInput.stories.tsx index f4bf84b1199a..a9604e720b2f 100644 --- a/libs/ui/packages/native/storybook/stories/Form/Input/BaseInput.stories.tsx +++ b/libs/ui/packages/native/storybook/stories/Form/Input/BaseInput.stories.tsx @@ -62,6 +62,7 @@ export const BaseInputRenderSideExempleStory = () => { value={value} onChange={onChange} renderLeft={renderLeft} + // @ts-expect-error inconsistenties in props renderRight={renderRight} placeholder={"test"} disabled={disabled} diff --git a/libs/ui/packages/react/src/components/Table/Table.stories.tsx b/libs/ui/packages/react/src/components/Table/Table.stories.tsx index c22603cf8c98..2e1b33fb20c2 100644 --- a/libs/ui/packages/react/src/components/Table/Table.stories.tsx +++ b/libs/ui/packages/react/src/components/Table/Table.stories.tsx @@ -465,10 +465,10 @@ const CustomRowContainer = styled(Table.RowContainer).attrs<{ onClick: () => voi `; export const CustomRows: StoryTemplate> = args => { - const [selectedRowIndex, setSelectedRowIndex] = useState(null); + const [selectedRowIndex, setSelectedRowIndex] = useState(); const renderRow = useCallback( - (rowIndex, children) => ( + (rowIndex: number, children?: React.ReactNode) => ( setSelectedRowIndex(rowIndex)}> {children} diff --git a/libs/ui/packages/react/src/components/form/BaseInput/Input.stories.tsx b/libs/ui/packages/react/src/components/form/BaseInput/Input.stories.tsx index 0fb234c9a5bd..129956beffec 100644 --- a/libs/ui/packages/react/src/components/form/BaseInput/Input.stories.tsx +++ b/libs/ui/packages/react/src/components/form/BaseInput/Input.stories.tsx @@ -67,6 +67,7 @@ export const RenderSideExemple = (): JSX.Element => { error={error} onChange={setValue} renderLeft={renderLeft} + // @ts-expect-error inconsistencie in props renderRight={renderRight} placeholder={"test"} /> diff --git a/libs/ui/packages/react/src/components/layout/List/VerticalTimeline/VerticalTimeline.stories.tsx b/libs/ui/packages/react/src/components/layout/List/VerticalTimeline/VerticalTimeline.stories.tsx index efc5bf084df7..48ab1e3f627c 100644 --- a/libs/ui/packages/react/src/components/layout/List/VerticalTimeline/VerticalTimeline.stories.tsx +++ b/libs/ui/packages/react/src/components/layout/List/VerticalTimeline/VerticalTimeline.stories.tsx @@ -33,7 +33,7 @@ const steps = [ */ estimatedTime?: number; }, - { + { status: ItemStatus; title: string; renderBody?: (isDisplayed?: boolean) => ReactNode; @@ -69,9 +69,12 @@ const defaultItems: Item[] = [ title: "step's {title} prop", renderBody: () => ( + {/* @ts-expect-error children props issue */} {`This box is the React node returned by the step's {renderBody} prop`} + {/* @ts-expect-error children props issue */} This subtitle text component is `VerticalTimeline.SubtitleText` + {/* @ts-expect-error children props issue */} This body text component is `VerticalTimeline.BodyText` ( @@ -88,6 +91,7 @@ const defaultItems: Item[] = [ estimatedTime: 120, renderBody: () => ( + {/* @ts-expect-error children props issue */} {`Your PIN can be 4 to 8 digits long. Anyone with access to your Nano and to your PIN can also access all your crypto and NFT assets.`} @@ -106,12 +110,16 @@ const defaultItems: Item[] = [ estimatedTime: 300, renderBody: () => ( + {/* @ts-expect-error children props issue */} {`Generate a new phrase`} + {/* @ts-expect-error children props issue */} {`Your device will generate a new secret recovery phrase. For your eyes only.`} + {/* @ts-expect-error children props issue */} {`Restore using Secret Recovery Phrase`} + {/* @ts-expect-error children props issue */} {`Make sure to use a Phrase generated by a Ledger for the guaranteed security of your assets. `} @@ -123,6 +131,7 @@ const defaultItems: Item[] = [ title: "Software check", renderBody: () => ( + {/* @ts-expect-error children props issue */} {`We'll verify whether your Nano is genuine. This should be quick and easy!`} ), @@ -132,6 +141,7 @@ const defaultItems: Item[] = [ title: "Install apps", renderBody: () => ( + {/* @ts-expect-error children props issue */} {`Installing apps`} ), @@ -139,6 +149,7 @@ const defaultItems: Item[] = [ { status: "inactive", title: "Nano is ready", + // @ts-expect-error children props issue renderBody: () => Almost there ..., }, ]; diff --git a/libs/ui/packages/react/src/components/navigation/Breadcrumb/Breadcrumb.stories.tsx b/libs/ui/packages/react/src/components/navigation/Breadcrumb/Breadcrumb.stories.tsx index 2428feb90076..33b02a3fef55 100644 --- a/libs/ui/packages/react/src/components/navigation/Breadcrumb/Breadcrumb.stories.tsx +++ b/libs/ui/packages/react/src/components/navigation/Breadcrumb/Breadcrumb.stories.tsx @@ -77,7 +77,7 @@ const Routes = ({ export const Breadcrumb = (args: Props): JSX.Element => { const [route, setRoute] = useState("apps/swap/confirm"); - const onChange = useCallback(value => setRoute(value.join("/")), [setRoute]); + const onChange = useCallback((value: string[]) => setRoute(value.join("/")), [setRoute]); const segments = useMemo(() => { const paths = route.split("/"); diff --git a/libs/ui/packages/react/src/components/tabs/Tabs/index.tsx b/libs/ui/packages/react/src/components/tabs/Tabs/index.tsx index 5ac9a329b60c..10b696657e21 100644 --- a/libs/ui/packages/react/src/components/tabs/Tabs/index.tsx +++ b/libs/ui/packages/react/src/components/tabs/Tabs/index.tsx @@ -9,7 +9,7 @@ export interface TabContent { title: string; disabled?: boolean; badge?: string | number; - Component: React.ReactFragment; + Component: React.ReactNode; } export type Props = React.PropsWithChildren<{