Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
File size: 2,819 Bytes
91c3567 5916048 d2a6779 91c3567 d2a6779 91c3567 5916048 d2a6779 91c3567 5916048 91c3567 d2a6779 91c3567 d2a6779 5916048 91c3567 e97023d 5916048 d2a6779 91c3567 5916048 91c3567 5916048 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
"use client";
import Image from "next/image";
import { TbMenu2 } from "react-icons/tb";
import { MdOutlineNightlight, MdOutlineLightMode } from "react-icons/md";
import classNames from "classnames";
import { useTheme } from "next-themes";
import { useEffect, useState } from "react";
import("highlight.js/styles/atom-one-dark.css");
import HFLogo from "assets/hf-logo.svg";
import { useUpdateEffect } from "react-use";
export const EditorHeader = ({
onToggleMenu,
}: {
onToggleMenu: () => void;
}) => {
const [mounted, setMounted] = useState(false);
const { theme, setTheme } = useTheme();
useEffect(() => {
setMounted(true);
}, []);
if (!mounted) {
return null;
}
return (
<header className="px-4 xl:px-6 py-2.5 border-b dark:border-slate-950 border-gray-200 bg-white dark:bg-slate-950 flex justify-between items-center">
<div className="w-5 h-5 block xl:hidden" onClick={onToggleMenu}>
<TbMenu2 className="w-full h-full text-slate-600 dark:text-slate-100" />
</div>
<Image src={HFLogo} alt="Hugging Face Logo" width={34} height={34} />
<p className="text-gray-800 dark:text-gray-300 font-code text-sm font-semibold">
Hub API Playground
</p>
<div className="hidden xl:flex items-center justify-end gap-3">
{/* <div className="bg-teal-600 w-3 h-3 rounded-full" />
<div className="bg-indigo-600 w-3 h-3 rounded-full" />
<div className="bg-purple-500 w-3 h-3 rounded-full" /> */}
<div className="rounded-full bg-gray-100 border-gray-200 dark:bg-slate-800 border dark:border-slate-700 p-0.5 flex items-center justify-between relative z-[1] cursor-pointer">
<div
className={classNames(
"transition-transform duration-200 ease-in-out top-0.5 w-6 h-6 rounded-full absolute -z-[1]",
{
"translate-x-full bg-indigo-500": theme === "dark",
"translate-x-0 bg-amber-500": theme === "light",
}
)}
/>
<div
className={`size-6 rounded-full flex items-center justify-center ${
theme === "light"
? "text-white"
: "dark:text-slate-500 text-gray-400"
} p-1`}
onClick={() => {
setTheme("light");
}}
>
<MdOutlineLightMode />
</div>
<div
className={`size-6 rounded-full flex items-center justify-center ${
theme === "dark"
? "text-white"
: "dark:text-slate-500 text-gray-400"
} p-1`}
onClick={() => {
setTheme("dark");
}}
>
<MdOutlineNightlight />
</div>
</div>
</div>
</header>
);
};
|