From e76a5f847e78fee4e62f6eb37d468557a1504c55 Mon Sep 17 00:00:00 2001 From: 简律纯 Date: Wed, 3 May 2023 01:22:45 +0800 Subject: --- .../pages/pack-home/PackBenchmarkTabs.tsx | 149 --------------------- 1 file changed, 149 deletions(-) delete mode 100644 docs/components/pages/pack-home/PackBenchmarkTabs.tsx (limited to 'docs/components/pages/pack-home/PackBenchmarkTabs.tsx') diff --git a/docs/components/pages/pack-home/PackBenchmarkTabs.tsx b/docs/components/pages/pack-home/PackBenchmarkTabs.tsx deleted file mode 100644 index f771fb1..0000000 --- a/docs/components/pages/pack-home/PackBenchmarkTabs.tsx +++ /dev/null @@ -1,149 +0,0 @@ -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}
-
- ); -} -- cgit v1.2.3-70-g09d2