import { useRef, useState } from "react"; import { AnimatePresence, motion } from "framer-motion"; import { BenchmarkCategory } from "./PackBenchmarks"; import classNames from "classnames"; import gradients from "../home-shared/gradients.module.css"; const TABS: { id: BenchmarkCategory; title: string; soon: boolean; tooltip: string; }[] = [ { id: "cold", title: "Cold Start", soon: false, tooltip: "First run", }, { id: "file_change", title: "File Change", soon: false, tooltip: "Hot Reload (HMR)", }, { id: "code_build", title: "Code Build", soon: true, tooltip: "First Build", }, { id: "build_from_cache", title: "Build from Cache", soon: true, tooltip: "Second Build", }, ]; const TRANSITION = { duration: 0.3, ease: [0.59, 0.15, 0.18, 0.93], }; function SoonBadge() { return ( Soon ); } export function PackBenchmarkTabs({ onTabChange, }: { onTabChange: (tab: BenchmarkCategory) => void; }) { const [activeTab, setActiveTab] = useState(0); const onTabClick = (index: number) => { if (TABS[index].soon) return; setActiveTab(index); onTabChange(TABS[index].id); }; return (
{TABS.map((tab, index) => ( ))}
); } function ToolTip({ text, children }: { text; children: React.ReactNode }) { const [show, setShow] = useState(false); const timeout = useRef(); const onMouseEnter = () => { timeout.current = setTimeout(() => { setShow(true); }, 800); }; const onMouseLeave = () => { clearTimeout(timeout.current); setShow(false); }; return (

{text}

{children}
); }