- Updated biome schema version from 2.3.1 to 2.3.11 in biome.json. - Refactored package.json for better readability and updated dependencies. - Adjusted class names in InformationBubble, ChatAttachments, ChatBubble, FileUpload, Loading, and other components for consistent styling. - Changed height classes from fixed pixel values to relative values for better responsiveness. - Removed unnecessary comments and unused variables in user.controller.ts.
89 lines
2.1 KiB
TypeScript
89 lines
2.1 KiB
TypeScript
import { ExternalLink } from "lucide-react";
|
|
import Link from "next/link";
|
|
import type { ReactNode } from "react";
|
|
import {
|
|
HybridTooltip,
|
|
HybridTooltipContent,
|
|
HybridTooltipTrigger,
|
|
} from "~/components/custom_ui/HybridTooltip";
|
|
import { IconMatrix, type IconType } from "~/components/IconComponents";
|
|
import { TooltipProvider } from "~/components/ui/tooltip";
|
|
import { cn } from "~/lib/utils";
|
|
|
|
/*
|
|
<TouchProvider>
|
|
<div className="relative">
|
|
<Button onClick={() => console.log("click")}>Azione </Button>
|
|
<InformationBubble href="/prezzi" txt="Informazioni sui prezzi" />
|
|
</div>
|
|
</TouchProvider>
|
|
*/
|
|
|
|
type ChildrenBubbleProps = {
|
|
children: ReactNode;
|
|
href?: undefined;
|
|
txt?: undefined;
|
|
target?: undefined;
|
|
};
|
|
|
|
type LinkBubbleProps = {
|
|
children?: undefined;
|
|
href: string;
|
|
txt: string;
|
|
target?: "_self" | "_blank" | "_parent" | "_top";
|
|
};
|
|
type InformationBubbleProps = {
|
|
className?: string;
|
|
iconClassName?: string;
|
|
icon?: IconType;
|
|
side?: "top" | "bottom" | "left" | "right";
|
|
} & (ChildrenBubbleProps | LinkBubbleProps);
|
|
|
|
const InformationBubble = ({
|
|
className,
|
|
icon = "circle-help",
|
|
iconClassName,
|
|
side,
|
|
children,
|
|
href,
|
|
txt,
|
|
target,
|
|
}: InformationBubbleProps) => {
|
|
return (
|
|
<TooltipProvider delayDuration={0}>
|
|
<HybridTooltip>
|
|
<HybridTooltipTrigger
|
|
className={cn(
|
|
`absolute -top-2 -right-2 flex size-6 items-center justify-center rounded-full bg-white`,
|
|
className,
|
|
)}
|
|
>
|
|
<IconMatrix
|
|
className={cn("size-6 text-indigo-500", iconClassName)}
|
|
type={icon}
|
|
/>
|
|
</HybridTooltipTrigger>
|
|
|
|
<HybridTooltipContent
|
|
className="-mb-1.5 border-border bg-white shadow-sm [&>span>svg]:invisible"
|
|
side={side}
|
|
>
|
|
{href ? (
|
|
<Link
|
|
className="flex items-center justify-center text-blue-500 text-sm underline-offset-2 hover:underline"
|
|
href={href}
|
|
target={target}
|
|
>
|
|
<ExternalLink className="mr-1 size-4" />
|
|
<p>{txt}</p>
|
|
</Link>
|
|
) : (
|
|
<>{children}</>
|
|
)}
|
|
</HybridTooltipContent>
|
|
</HybridTooltip>
|
|
</TooltipProvider>
|
|
);
|
|
};
|
|
|
|
export default InformationBubble;
|