Spaces:
Paused
Paused
Download components/comparison-table.tsx from samirhosninet/HubAPI: direct link, hf CLI and curl.
- Browser
- Download file 6.52 kB
-
https://huggingface.co/spaces/samirhosninet/HubAPI/resolve/main/components/comparison-table.tsx
- Command line
-
hf download hf://spaces/samirhosninet/HubAPI/components/comparison-table.tsx
-
curl -L -o comparison-table.tsx https://huggingface.co/spaces/samirhosninet/HubAPI/resolve/main/components/comparison-table.tsx
6.52 kB
| "use client"; | |
| import { Check, X } from "lucide-react"; | |
| import { useLanguage } from "@/components/LanguageContext"; | |
| import { translations } from "@/lib/languages"; | |
| import { ShimmerButton } from "@/components/ui/shimmer-button"; | |
| type TranslationKeys = keyof typeof translations.en; | |
| const ROW_INDICES = [1, 2, 3, 4, 5, 6, 7, 8, 9] as const; | |
| export function ComparisonTable() { | |
| const { t, language } = useLanguage(); | |
| const scrollToWaitlist = () => { | |
| const input = document.getElementById("email-input"); | |
| if (input) { | |
| input.scrollIntoView({ behavior: "smooth", block: "center" }); | |
| setTimeout(() => input.focus(), 850); | |
| } | |
| }; | |
| const scrollToModels = () => { | |
| document.getElementById("models")?.scrollIntoView({ behavior: "smooth", block: "start" }); | |
| }; | |
| return ( | |
| <section className="relative z-10 w-full max-w-5xl mx-auto px-4 md:px-6 py-20 md:py-28"> | |
| <div className="absolute top-0 left-1/2 -translate-x-1/2 w-full h-px bg-gradient-to-r from-transparent via-primary/20 to-transparent" /> | |
| <div className="text-center space-y-5 mb-10 max-w-3xl mx-auto"> | |
| <div className="inline-flex items-center rounded-full border border-primary/20 bg-primary/5 px-4 py-1.5 text-sm font-medium text-primary backdrop-blur-sm shadow-sm font-mono tracking-widest uppercase"> | |
| <span className="relative flex h-2 w-2 mr-2.5 rtl:mr-0 rtl:ml-2.5"> | |
| <span className="animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"></span> | |
| <span className="relative inline-flex rounded-full h-2 w-2 bg-primary"></span> | |
| </span> | |
| {t("compBadge")} | |
| </div> | |
| <h2 className="text-3xl font-extrabold tracking-tight sm:text-5xl text-foreground pb-1"> | |
| {t("compTitle")} | |
| </h2> | |
| <div className="space-y-3 text-sm md:text-base text-muted-foreground font-mono text-start max-w-2xl mx-auto"> | |
| <p className="text-foreground/90 font-semibold">{t("compIntroLead")}</p> | |
| <p>{t("compIntro1")}</p> | |
| <p>{t("compIntro2")}</p> | |
| <p>{t("compIntro3")}</p> | |
| <p>{t("compIntroClosing")}</p> | |
| <p className="text-foreground/90 font-medium pt-1">{t("compIntroSummary")}</p> | |
| </div> | |
| </div> | |
| <div | |
| className="md:hidden flex justify-center items-center gap-1.5 text-[9px] text-muted-foreground/60 mb-3 font-mono uppercase tracking-widest animate-pulse select-none" | |
| aria-hidden="true" | |
| > | |
| <span> | |
| {language === "ar" ? "← اسحب الجدول أفقياً للمزيد →" : "← Swipe table horizontally to see more →"} | |
| </span> | |
| </div> | |
| <div className="inverted-card w-full overflow-hidden border border-[var(--card-contrast-border)] rounded-2xl backdrop-blur-md shadow-[var(--menu-shadow)] transition-all duration-300"> | |
| <div className="w-full overflow-x-auto"> | |
| <table className="w-full border-collapse text-start font-mono text-xs md:text-sm"> | |
| <thead> | |
| <tr className="border-b border-border bg-muted/50"> | |
| <th | |
| scope="col" | |
| className="py-5 px-6 font-bold text-foreground uppercase tracking-wider text-start" | |
| > | |
| {t("compThFeatures")} | |
| </th> | |
| <th | |
| scope="col" | |
| className="py-5 px-6 font-bold text-muted-foreground uppercase tracking-wider w-[34%] text-start" | |
| > | |
| {t("compThDirect")} | |
| </th> | |
| <th | |
| scope="col" | |
| className="py-5 px-6 font-bold text-primary uppercase tracking-wider w-[34%] bg-primary/10 text-start" | |
| > | |
| {t("compThHub")} | |
| </th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| {ROW_INDICES.map((num, idx) => { | |
| const featureKey = `compRow${num}F` as TranslationKeys; | |
| const directKey = `compRow${num}Direct` as TranslationKeys; | |
| const hubKey = `compRow${num}Hub` as TranslationKeys; | |
| return ( | |
| <tr | |
| key={idx} | |
| className="border-b border-border hover:bg-primary/[0.03] transition-colors duration-200 group" | |
| > | |
| <td className="py-4 px-6 font-medium text-foreground group-hover:text-primary transition-colors duration-200 text-start"> | |
| {t(featureKey)} | |
| </td> | |
| <td className="py-4 px-6 text-muted-foreground text-start"> | |
| <div className="flex items-center gap-2"> | |
| <X className="h-4 w-4 text-rose-500/80 shrink-0" aria-hidden /> | |
| <span>{t(directKey)}</span> | |
| </div> | |
| </td> | |
| <td className="py-4 px-6 text-foreground font-semibold bg-primary/[0.01] text-start"> | |
| <div className="flex items-center gap-2"> | |
| <Check className="h-4 w-4 text-primary shrink-0" aria-hidden /> | |
| <span>{t(hubKey)}</span> | |
| </div> | |
| </td> | |
| </tr> | |
| ); | |
| })} | |
| </tbody> | |
| </table> | |
| </div> | |
| </div> | |
| <div className="mt-10 flex flex-col sm:flex-row items-stretch sm:items-center justify-center gap-3"> | |
| <ShimmerButton | |
| type="button" | |
| onClick={scrollToWaitlist} | |
| borderRadius="8px" | |
| className="w-full sm:w-auto h-12 px-8 uppercase font-mono text-xs tracking-[0.2em] font-bold cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary" | |
| > | |
| <span className="relative z-10">{t("heroCtaGetKey")}</span> | |
| </ShimmerButton> | |
| <button | |
| type="button" | |
| onClick={scrollToModels} | |
| className="w-full sm:w-auto h-12 px-8 uppercase font-mono text-xs tracking-[0.2em] font-bold cursor-pointer border border-border bg-secondary/20 dark:bg-white/5 hover:bg-primary/10 hover:border-primary/40 hover:text-primary transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary [clip-path:polygon(12px_0,100%_0,100%_calc(100%_-_12px),calc(100%_-_12px)_100%,0_100%,0_12px)]" | |
| > | |
| {t("heroCtaViewModels")} | |
| </button> | |
| </div> | |
| </section> | |
| ); | |
| } | |