providers.jsx 831 Bytes
Newer Older
wuhao's avatar
wuhao committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
"use client";

import { useRouter } from "next/navigation";
import {
  NextUIProvider,
  Tabs,
  Tab,
  Card,
  CardBody,
  Link,
} from "@nextui-org/react";
import { usePathname } from "next/navigation";

export function Providers({ children }) {
  const router = useRouter();
  const pathname = usePathname();

  return (
    <NextUIProvider navigate={router.push}>
wuhao's avatar
wuhao committed
20 21 22 23 24 25
      <div className="flex w-full flex-col mb-4">
        <Tabs aria-label="Options" radius={'full'} color="primary" selectedKey={pathname} onSelectionChange={(key)=>{
          router.push(key)
        }}>
          <Tab key="/"  title={'首页'}></Tab>
          <Tab key="/addItem" title={'DOC'}></Tab>
wuhao's avatar
wuhao committed
26
        </Tabs>
wuhao's avatar
wuhao committed
27 28 29
      </div>
      {/* <Link href="/">首页</Link>
      <Link href="/addItem">DOC</Link> */}
wuhao's avatar
wuhao committed
30 31 32 33
      {children}
    </NextUIProvider>
  );
}