You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

layout.tsx 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. 'use client'
  2. import { Layout, Menu } from 'antd'
  3. import {
  4. HomeOutlined,
  5. MessageOutlined,
  6. UserOutlined,
  7. } from '@ant-design/icons'
  8. import Header from '@/components/layout/Header'
  9. import { useRouter, usePathname } from 'next/navigation'
  10. const { Content } = Layout
  11. const AppLayout = ({ children }: { children: React.ReactNode }) => {
  12. const router = useRouter()
  13. const pathname = usePathname()
  14. const navItems = [
  15. {
  16. key: '/user/dashboard',
  17. icon: <HomeOutlined />,
  18. label: 'Home',
  19. },
  20. {
  21. key: '/user/chatboard',
  22. icon: <MessageOutlined />,
  23. label: 'Chat',
  24. },
  25. {
  26. key: '/user/profile',
  27. icon: <UserOutlined />,
  28. label: 'Profile',
  29. },
  30. ]
  31. return (
  32. <Layout className="w-full max-w-[430px] min-h-screen mx-auto shadow-xl relative">
  33. <Header />
  34. <Content className="flex-1 overflow-auto bg-white pb-20" style={{minHeight:"93vh"}}>
  35. {children}
  36. </Content>
  37. {/* Bottom Nav */}
  38. <div className="fixed bottom-0 w-full max-w-[430px] mx-auto left-0 right-0 border-t border-gray-200 shadow-inner z-50 bg-white">
  39. <Menu
  40. mode="horizontal"
  41. selectedKeys={[pathname]}
  42. onClick={({ key }) => router.push(key)}
  43. items={navItems}
  44. className="flex justify-around"
  45. />
  46. </div>
  47. </Layout>
  48. )
  49. }
  50. export default AppLayout