Download code/web/src/components/site-header.tsx from MiniMaxAI/oss-ecosystem-data: direct link, hf CLI and curl.
- Browser
- Download file 3.79 kB
-
https://huggingface.co/datasets/MiniMaxAI/oss-ecosystem-data/resolve/675a4368f9d0cd2789edc7bb3f3ca6c76c42b9da/code/web/src/components/site-header.tsx
- Command line
-
hf download hf://datasets/MiniMaxAI/oss-ecosystem-data@675a4368f9d0cd2789edc7bb3f3ca6c76c42b9da/code/web/src/components/site-header.tsx
-
curl -L -o site-header.tsx https://huggingface.co/datasets/MiniMaxAI/oss-ecosystem-data/resolve/675a4368f9d0cd2789edc7bb3f3ca6c76c42b9da/code/web/src/components/site-header.tsx
3.79 kB
| import { ArrowUpRight, ChevronDown } from "lucide-react" | |
| import { | |
| DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, | |
| DropdownMenuSeparator, DropdownMenuTrigger, | |
| } from "@/components/ui/dropdown-menu" | |
| import type { Site } from "@/lib/types" | |
| import { catColor } from "@/lib/category" | |
| import { full } from "@/lib/format" | |
| import { href } from "@/lib/route" | |
| import { Logo } from "@/components/logo" | |
| /** Sits on the hero video of every page: the MiniMax logo home, and every model page in a menu. */ | |
| export function SiteHeader({ site }: { site: Site }) { | |
| const rel = (k: string) => site.releases.find((r) => r.key === k)! | |
| return ( | |
| <header className="relative z-20 mx-auto flex w-full max-w-[1200px] items-center justify-between gap-4 px-4 py-5 sm:px-8 sm:py-6"> | |
| <a href={href()} className="-m-1.5 rounded-lg p-1.5 text-white focus-visible:outline-2 focus-visible:outline-white"> | |
| <Logo className="h-8 w-auto sm:h-9" /> | |
| </a> | |
| <DropdownMenu modal={false}> | |
| <DropdownMenuTrigger className="group inline-flex h-10 items-center gap-1.5 rounded-full bg-white px-4.5 text-[15px] font-medium text-[#171717] transition-colors hover:bg-border5 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white data-[state=open]:bg-border5"> | |
| Models | |
| <ChevronDown className="size-4 transition-transform duration-200 group-data-[state=open]:rotate-180" /> | |
| </DropdownMenuTrigger> | |
| <DropdownMenuContent align="end" sideOffset={10} | |
| className="w-[300px] rounded-2xl border border-border bg-white p-2 text-foreground shadow-[0_24px_60px_-12px_rgba(23,23,23,0.25)]"> | |
| {site.categories.map((c, i) => { | |
| const pages = c.releases.map(rel).filter((r) => r.page) | |
| const total = c.releases.reduce((a, k) => a + rel(k).n, 0) | |
| return ( | |
| <DropdownMenuGroup key={c.key}> | |
| {i > 0 && <DropdownMenuSeparator className="my-1.5 bg-border" />} | |
| <DropdownMenuItem asChild className="rounded-lg px-2.5 py-2 text-[15px] focus:bg-muted"> | |
| <a href={href(c.key)} className="flex items-center gap-2.5"> | |
| <span className="size-2.5 rounded-full" style={{ background: catColor(c.key) }} /> | |
| <span className="font-semibold">{c.name}</span> | |
| <span className="ml-auto font-display text-muted-foreground tabular-nums">{full(total)}</span> | |
| </a> | |
| </DropdownMenuItem> | |
| {pages.length > 1 && pages.map((r) => ( | |
| <DropdownMenuItem key={r.key} asChild className="rounded-lg py-1.5 pr-2.5 pl-7 text-[15px] text-foreground/80 focus:bg-muted focus:text-foreground"> | |
| <a href={href(c.key, r.key)} className="flex items-center"> | |
| {r.name} | |
| <span className="ml-auto font-display text-muted-foreground tabular-nums">{full(r.n)}</span> | |
| </a> | |
| </DropdownMenuItem> | |
| ))} | |
| </DropdownMenuGroup> | |
| ) | |
| })} | |
| <DropdownMenuSeparator className="my-1.5 bg-border" /> | |
| <DropdownMenuLabel className="sr-only">Elsewhere</DropdownMenuLabel> | |
| <DropdownMenuItem asChild className="rounded-lg px-2.5 py-2 text-[15px] text-foreground/80 focus:bg-muted focus:text-foreground"> | |
| <a href="https://huggingface.co/MiniMaxAI" target="_blank" rel="noopener" className="flex items-center gap-2"> | |
| MiniMaxAI on Hugging Face <ArrowUpRight className="ml-auto size-4 text-muted-foreground" /> | |
| </a> | |
| </DropdownMenuItem> | |
| </DropdownMenuContent> | |
| </DropdownMenu> | |
| </header> | |
| ) | |
| } | |