🎉 创世提交
This commit is contained in:
43
src/App.tsx
Normal file
43
src/App.tsx
Normal file
@@ -0,0 +1,43 @@
|
||||
import { Component, ParentProps, createSignal } from "solid-js";
|
||||
import Sidebar from "./components/Sidebar";
|
||||
import "./App.css";
|
||||
import { SidebarProvider, useIsMobile, useSidebar } from "./components/ui/sidebar";
|
||||
import TitleBar from "./components/TitleBar";
|
||||
import { Toaster } from "./components/ui/toast";
|
||||
|
||||
const App: Component = (props: ParentProps) => {
|
||||
const isMobile = useIsMobile();
|
||||
const [shouldRefresh, setShouldRefresh] = createSignal(false);
|
||||
|
||||
const handleRefresh = () => {
|
||||
setShouldRefresh(prev => !prev);
|
||||
};
|
||||
|
||||
return (
|
||||
<div class="app-layout">
|
||||
<SidebarProvider>
|
||||
{/* 根据刷新状态重新渲染 Sidebar */}
|
||||
{shouldRefresh() ? (
|
||||
<Sidebar />
|
||||
) : (
|
||||
<Sidebar />
|
||||
)}
|
||||
<div class="flex flex-col w-full">
|
||||
<Toaster />
|
||||
<TitleBar onRefresh={handleRefresh} isSidebarOpen={!isMobile() && useSidebar().open()} />
|
||||
{shouldRefresh() ? (
|
||||
<main class="main-content w-full h-[calc(100vh-48px)] mt-12 overflow-y-auto" id="main-content">
|
||||
{props.children}
|
||||
</main>
|
||||
) : (
|
||||
<main class="main-content w-full h-[calc(100vh-48px)] mt-12 overflow-y-auto" id="main-content">
|
||||
{props.children}
|
||||
</main>
|
||||
)}
|
||||
</div>
|
||||
</SidebarProvider>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default App;
|
||||
Reference in New Issue
Block a user