Skip to content

Commit e448f51

Browse files
committed
fix: also adds null to type
1 parent 72f23bd commit e448f51

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed

src/docs/pages/TooltipsPage.tsx

+15-11
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
1-
import type { FC } from 'react';
1+
import { useState, type FC } from 'react';
22
import { Button, Tooltip } from '../../lib';
33
import type { CodeExample } from './DemoPage';
44
import { DemoPage } from './DemoPage';
55

6+
const ValidTsx = () => {
7+
const [state, setState] = useState<boolean>(false);
8+
9+
return <div className="flex gap-2">
10+
<Tooltip isOpen placement="bottom" content="Always open">
11+
<Button>Always open</Button>
12+
</Tooltip>
13+
<Tooltip isOpen={state} placement="bottom" content="Always open">
14+
<Button onClick={() => setState((prev) => !prev)}>Always closed</Button>
15+
</Tooltip>
16+
</div>
17+
}
18+
619
const TooltipsPage: FC = () => {
720
const examples: CodeExample[] = [
821
{
@@ -60,16 +73,7 @@ const TooltipsPage: FC = () => {
6073
},
6174
{
6275
title: 'Stay open and stay closed tooltips',
63-
code: (
64-
<div className="flex gap-2">
65-
<Tooltip isOpen placement="bottom" content="Always open">
66-
<Button>Always open</Button>
67-
</Tooltip>
68-
<Tooltip isOpen={false} placement="bottom" content="Always open">
69-
<Button disabled>Always closed</Button>
70-
</Tooltip>
71-
</div>
72-
),
76+
code: <ValidTsx/>,
7377
},
7478
{
7579
title: 'Animation',

src/lib/components/Floating/Floating.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export interface FloatingProps extends PropsWithChildren<Omit<ComponentProps<'di
4747
style?: 'dark' | 'light' | 'auto';
4848
theme: FlowbiteFloatingTheme;
4949
trigger?: 'hover' | 'click';
50-
isOpen?: boolean;
50+
isOpen?: boolean | null;
5151
}
5252

5353
/**

src/lib/components/Tooltip/Tooltip.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export interface TooltipProps extends PropsWithChildren<Omit<ComponentProps<'div
1616
style?: 'dark' | 'light' | 'auto';
1717
theme?: DeepPartial<FlowbiteTooltipTheme>;
1818
trigger?: 'hover' | 'click';
19-
isOpen?: boolean;
19+
isOpen?: boolean | null;
2020
}
2121

2222
/**

0 commit comments

Comments
 (0)