-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
156 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
VITE_APP_BASE_URL="/" | ||
VITE_APP_API_URL="//127.0.0.1:5050/api" | ||
VITE_APP_TITLE="XX系统" | ||
VITE_APP_TITLE_SUFFIX ="XX系统" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Helmet } from "react-helmet-async"; | ||
import { useMatches } from "react-router-dom"; | ||
import { at } from "@/utils"; | ||
|
||
export function AppHelmet() { | ||
const matches = useMatches(); | ||
const currRouter = at(matches, -1); | ||
return ( | ||
<Helmet> | ||
<title> | ||
{(currRouter?.handle as any)?.title || "React"} | {import.meta.env.VITE_APP_TITLE_SUFFIX} | ||
</title> | ||
</Helmet> | ||
); | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,63 @@ | ||
import { useEffect } from "react"; | ||
import { MenuFoldOutlined, MenuUnfoldOutlined } from "@ant-design/icons"; | ||
import { Button, Flex, Layout } from "antd"; | ||
import { AppHelmet } from "@/components/helmet"; | ||
import { ThemeSwitch } from "@/components/theme-switch"; | ||
import Breadcrumb from "./components/breadcrumb"; | ||
import Content from "./components/content"; | ||
import Breadcrumb from "./components/bread-crumb"; | ||
import CustomSkin from "./components/custom-skin"; | ||
import Sider from "./components/sider"; | ||
import Content from "./components/main-content"; | ||
import SiderBar from "./components/sider-bar"; | ||
import UserAvatar from "./components/user-avatar"; | ||
import { setCollapsed, useSelector, useSettingsStore } from "@/stores"; | ||
|
||
export default function MainLayout() { | ||
const { collapsed } = useSettingsStore(useSelector(["collapsed"])); | ||
|
||
// 设置header阴影 | ||
useEffect(() => { | ||
const handleScroll = () => { | ||
const scrollTop = document.scrollingElement?.scrollTop || document.body.scrollTop; | ||
const className = "shadow-[0_6px_10px_-10px_rgba(0,0,0,0.3)]"; | ||
if (scrollTop > 0) { | ||
document.getElementById("app-header-bar")?.classList.add(className); | ||
} else { | ||
document.getElementById("app-header-bar")?.classList.remove(className); | ||
} | ||
}; | ||
window.addEventListener("scroll", handleScroll); | ||
return () => { | ||
window.removeEventListener("scroll", handleScroll); | ||
}; | ||
}, []); | ||
|
||
console.log("out 👉: "); | ||
|
||
return ( | ||
<Layout> | ||
<Sider /> | ||
<> | ||
<AppHelmet /> | ||
<Layout> | ||
<Layout.Header className="flex items-center sticky top-0 z-[999] pl-0 bg-white dark:bg-[#001529]"> | ||
<Button | ||
type="text" | ||
icon={collapsed ? <MenuUnfoldOutlined /> : <MenuFoldOutlined />} | ||
onClick={() => setCollapsed(!collapsed)} | ||
className="mr-2" | ||
/> | ||
<Breadcrumb /> | ||
<Flex gap={12} className="ml-auto items-center"> | ||
<CustomSkin /> | ||
<ThemeSwitch /> | ||
<UserAvatar /> | ||
</Flex> | ||
</Layout.Header> | ||
<Content /> | ||
<SiderBar /> | ||
<Layout> | ||
<Layout.Header | ||
id="app-header-bar" | ||
className="flex items-center sticky top-0 z-[999] pl-0 bg-white dark:bg-[#001529]" | ||
> | ||
<Button | ||
type="text" | ||
icon={collapsed ? <MenuUnfoldOutlined /> : <MenuFoldOutlined />} | ||
onClick={() => setCollapsed(!collapsed)} | ||
className="mr-2" | ||
/> | ||
<Breadcrumb /> | ||
<Flex gap={12} className="ml-auto items-center"> | ||
<CustomSkin /> | ||
<ThemeSwitch /> | ||
<UserAvatar /> | ||
</Flex> | ||
</Layout.Header> | ||
<Content /> | ||
</Layout> | ||
</Layout> | ||
</Layout> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Outlet } from "react-router-dom"; | ||
|
||
export default function NavLayout() { | ||
return ( | ||
<div className="text-indigo-700"> | ||
Nav Layout | ||
<Outlet /> | ||
</div> | ||
); | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.