diff --git a/README.md b/README.md index 260ab74..7afb6c7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## TODO -页头个人中心 +全局修改断点命名 页头链接完善跳转地址 diff --git a/src/app/admin/_client/header.tsx b/src/app/admin/_client/header.tsx index 4224e7a..99e929c 100644 --- a/src/app/admin/_client/header.tsx +++ b/src/app/admin/_client/header.tsx @@ -13,21 +13,21 @@ export default function Header(props: HeaderProps) { return (
{/* left */}
- + 欢迎来到,蓝狐代理
diff --git a/src/app/admin/_client/layout.tsx b/src/app/admin/_client/layout.tsx new file mode 100644 index 0000000..47534b9 --- /dev/null +++ b/src/app/admin/_client/layout.tsx @@ -0,0 +1,81 @@ +'use client' +import {ReactNode} from 'react' +import {useLayoutStore} from '@/components/providers/StoreProvider' +import {merge} from '@/lib/utils' +import {Slot} from '@radix-ui/react-slot' + +type AdminLayoutProps = { + navbar: ReactNode + header: ReactNode + content: ReactNode +} + +export default function Layout(props: AdminLayoutProps) { + const navbar = useLayoutStore(store => store.navbar) + const setNevBar = useLayoutStore(store => store.setNavbar) + + return ( +
+ + {/* 结构 */} +
+
+ {props.navbar} +
+ +
+ {props.header} +
+ + + + + + + + + + + + + + +
setNevBar(false)} + > +
+
+ + {/* 内容 */} +
+ {props.content} +
+
+ ) +} diff --git a/src/app/admin/_client/navbar.tsx b/src/app/admin/_client/navbar.tsx index 15938ea..303d5bc 100644 --- a/src/app/admin/_client/navbar.tsx +++ b/src/app/admin/_client/navbar.tsx @@ -1,5 +1,5 @@ 'use client' -import {ReactNode, useState} from 'react' +import {ComponentProps, ReactNode, useState} from 'react' import {merge} from '@/lib/utils' import {useLayoutStore} from '@/components/providers/StoreProvider' import Link from 'next/link' @@ -19,7 +19,7 @@ import {Eye} from 'lucide-react' import {Archive} from 'lucide-react' import {ArchiveRestore} from 'lucide-react' -export type NavbarProps = {} +export type NavbarProps = {} & ComponentProps<'nav'> export default function Navbar(props: NavbarProps) { const navbar = useLayoutStore(store => store.navbar) @@ -29,10 +29,8 @@ export default function Navbar(props: NavbarProps) { data-expand={navbar} className={merge( `transition-[flex-basis] duration-300 ease-in-out`, - `flex-none`, `flex flex-col overflow-hidden group`, `data-[expand=true]:basis-52 data-[expand=false]:basis-16`, - ` `, )}> {/* logo */} @@ -119,6 +117,13 @@ function NavItem(props: { } } + const setNavbar = useLayoutStore(store => store.setNavbar) + const closeNavBarIfMobile = () => { + if (window.innerWidth < 768) { + setNavbar(false) + } + } + return ( @@ -129,7 +134,9 @@ function NavItem(props: { `hover:bg-gray-100`, `group-data-[expand=true]:px-4`, )} - href={props.href}> + href={props.href} + onClick={closeNavBarIfMobile} + > {props.icon}
-

账单管理

-
+ 账单类型}> {({id, field}) => ( diff --git a/src/app/admin/layout.tsx b/src/app/admin/layout.tsx index 554f52d..f81a37f 100644 --- a/src/app/admin/layout.tsx +++ b/src/app/admin/layout.tsx @@ -1,7 +1,7 @@ import {ReactNode} from 'react' -import {merge} from '@/lib/utils' import Header from './_client/header' -import Navbar from '@/app/admin/_client/navbar' +import Navbar from './_client/navbar' +import Layout from './_client/layout' export type AdminLayoutProps = { children: ReactNode @@ -9,17 +9,10 @@ export type AdminLayoutProps = { export default async function AdminLayout(props: AdminLayoutProps) { return ( -
- - - -
-
- {props.children} -
-
+ } + header={
} + content={props.children} + /> ) } diff --git a/src/app/admin/resources/_client/short.tsx b/src/app/admin/resources/_client/short.tsx index 4628b97..e118345 100644 --- a/src/app/admin/resources/_client/short.tsx +++ b/src/app/admin/resources/_client/short.tsx @@ -108,19 +108,18 @@ export default function ShortResource(props: ShortResourceProps) { }, }) - const onSubmit = async (value: FilterSchema) => { + const handler = form.handleSubmit(async (value: FilterSchema) => { await refresh(1, data.size) - } + }) return ( <> {/* 操作区 */}
-
- + 套餐编号}> {({id, field}) => ( diff --git a/src/components/composites/user-center/index.tsx b/src/components/composites/user-center/index.tsx index 3377973..69805be 100644 --- a/src/components/composites/user-center/index.tsx +++ b/src/components/composites/user-center/index.tsx @@ -52,10 +52,10 @@ export default function UserCenter() { {profile.name} - +