Skip to content

Commit

Permalink
Add tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
congmul committed Jul 10, 2024
1 parent 039528a commit ca5d4a0
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/components/Tooltip/Tooltip.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from 'react';
import { Tooltip, OverlayTrigger, Button } from 'react-bootstrap';
import { Placement } from "react-bootstrap/esm/types"

interface TooltipComponentType {
placement?: Placement
message: string
children: React.ReactNode
}
const TooltipComponent:React.FC<TooltipComponentType> = ({ message, children, placement='top' }) => {
const renderTooltip = (props:any) => (
<Tooltip {...props}>
{message}
</Tooltip>
);

return (
<OverlayTrigger
placement={placement}
delay={{ show: 250, hide: 400 }}
overlay={renderTooltip}
>
<Button variant="secondary">
{children}
</Button>
</OverlayTrigger>
);
};

export default TooltipComponent;

0 comments on commit ca5d4a0

Please sign in to comment.