mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
feat: initial commit
This commit is contained in:
30
components/shared/date-tooltip.tsx
Normal file
30
components/shared/date-tooltip.tsx
Normal file
@@ -0,0 +1,30 @@
|
||||
import {
|
||||
Tooltip,
|
||||
TooltipContent,
|
||||
TooltipProvider,
|
||||
TooltipTrigger,
|
||||
} from "@/components/ui/tooltip";
|
||||
import { format, formatDistanceToNow } from "date-fns";
|
||||
|
||||
interface Props {
|
||||
date: string;
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
|
||||
export const DateTooltip = ({ date, children }: Props) => {
|
||||
return (
|
||||
<TooltipProvider delayDuration={0}>
|
||||
<Tooltip>
|
||||
<TooltipTrigger>
|
||||
<span className="flex items-center text-muted-foreground text-left">
|
||||
{children}{" "}
|
||||
{formatDistanceToNow(new Date(date), {
|
||||
addSuffix: true,
|
||||
})}
|
||||
</span>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>{format(new Date(date), "PPpp")}</TooltipContent>
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user