Skip to content

Commit

Permalink
fix: also adds null to type
Browse files Browse the repository at this point in the history
  • Loading branch information
brenoliradev committed Apr 30, 2024
1 parent 72f23bd commit e448f51
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
26 changes: 15 additions & 11 deletions src/docs/pages/TooltipsPage.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
import type { FC } from 'react';
import { useState, type FC } from 'react';
import { Button, Tooltip } from '../../lib';
import type { CodeExample } from './DemoPage';
import { DemoPage } from './DemoPage';

const ValidTsx = () => {
const [state, setState] = useState<boolean>(false);

return <div className="flex gap-2">
<Tooltip isOpen placement="bottom" content="Always open">
<Button>Always open</Button>
</Tooltip>
<Tooltip isOpen={state} placement="bottom" content="Always open">
<Button onClick={() => setState((prev) => !prev)}>Always closed</Button>
</Tooltip>
</div>
}

const TooltipsPage: FC = () => {
const examples: CodeExample[] = [
{
Expand Down Expand Up @@ -60,16 +73,7 @@ const TooltipsPage: FC = () => {
},
{
title: 'Stay open and stay closed tooltips',
code: (
<div className="flex gap-2">
<Tooltip isOpen placement="bottom" content="Always open">
<Button>Always open</Button>
</Tooltip>
<Tooltip isOpen={false} placement="bottom" content="Always open">
<Button disabled>Always closed</Button>
</Tooltip>
</div>
),
code: <ValidTsx/>,
},
{
title: 'Animation',
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/Floating/Floating.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export interface FloatingProps extends PropsWithChildren<Omit<ComponentProps<'di
style?: 'dark' | 'light' | 'auto';
theme: FlowbiteFloatingTheme;
trigger?: 'hover' | 'click';
isOpen?: boolean;
isOpen?: boolean | null;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/Tooltip/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface TooltipProps extends PropsWithChildren<Omit<ComponentProps<'div
style?: 'dark' | 'light' | 'auto';
theme?: DeepPartial<FlowbiteTooltipTheme>;
trigger?: 'hover' | 'click';
isOpen?: boolean;
isOpen?: boolean | null;
}

/**
Expand Down

0 comments on commit e448f51

Please sign in to comment.