Add simple tooltip component

This commit is contained in:
Braydon 2024-04-22 01:03:52 -04:00
parent 5d2136ce5a
commit f021eb4809

@ -0,0 +1,39 @@
import { ReactElement, ReactNode } from "react";
import {
Tooltip,
TooltipContent,
TooltipTrigger,
} from "@/components/ui/tooltip";
/**
* The props for a simple tooltip.
*/
type SimpleTooltipProps = {
/**
* The content to display in the tooltip.
*/
content: string;
/**
* The children to render in this tooltip.
*/
children: ReactNode;
};
/**
* A simple tooltip, this is wrapping the
* shadcn tooltip to make it easier to use.
*
* @return the tooltip jsx
*/
const SimpleTooltip = ({
content,
children,
}: SimpleTooltipProps): ReactElement => (
<Tooltip>
<TooltipTrigger asChild>{children}</TooltipTrigger>
<TooltipContent>{content}</TooltipContent>
</Tooltip>
);
export default SimpleTooltip;