Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions report/src/components/StatCard.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,40 @@
import { ReactNode } from "react";
import clsx from "clsx";
import Tooltip from "./Tooltip";

interface StatCardProps {
title: string;
children: ReactNode;
className?: string;
titleTooltip?: ReactNode;
}

const StatCard = ({ title, children, className }: StatCardProps) => {
const StatCard = ({
title,
children,
className,
titleTooltip,
}: StatCardProps) => {
return (
<section
className={clsx(
"border border-slate-200 bg-white rounded-lg p-6",
className,
)}
>
<h2 className="text-sm font-semibold text-slate-500 uppercase tracking-wide mb-4">
{title}
<h2 className="text-sm font-semibold text-slate-500 uppercase tracking-wide mb-4 flex items-center gap-x-1.5">
<span>{title}</span>
{titleTooltip && (
<Tooltip content={titleTooltip} side="top" align="start">
<button
type="button"
aria-label="More info"
className="inline-flex items-center justify-center w-4 h-4 rounded-full border border-slate-300 text-slate-400 text-[10px] font-bold leading-none hover:border-slate-500 hover:text-slate-600 transition-colors cursor-help normal-case"
>
i
</button>
</Tooltip>
)}
</h2>
{children}
</section>
Expand Down
2 changes: 1 addition & 1 deletion report/src/components/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as TooltipPrimitive from "@radix-ui/react-tooltip";

interface TooltipProps {
children: React.ReactNode;
content: string;
content: React.ReactNode;
className?: string;
delayDuration?: number;
side?: "top" | "right" | "bottom" | "left";
Expand Down
Loading
Loading