feat: add basic layout #3

Merged
typist merged 3 commits from feat/add-sidebar into main 2025-10-27 23:48:34 +08:00
3 changed files with 41 additions and 5 deletions
Showing only changes of commit 7b67934b80 - Show all commits

View File

@@ -0,0 +1,25 @@
import { Sidebar, SidebarContent, SidebarFooter, SidebarHeader, SidebarMenuButton, SidebarMenuItem } from "@/components/ui/sidebar";
import { tools } from "@/components/tool";
export const AppSidebar = () => (
<Sidebar>
<SidebarHeader>
Lite Kit
</SidebarHeader>
<SidebarContent>
{
tools.map((tool) => (
<SidebarMenuItem key={tool.name}>
<SidebarMenuButton>
{tool.icon}
{tool.name}
</SidebarMenuButton>
</SidebarMenuItem>
))
}
</SidebarContent>
<SidebarFooter>
<a href="mailto:litek@mail.typist.cc">contact us</a>
</SidebarFooter>
</Sidebar>
)

View File

@@ -0,0 +1,8 @@
interface Tool {
name: string;
description: string;
icon: React.ReactNode;
component: React.ReactNode;
}
export const tools: Tool[] = [];

View File

@@ -5,6 +5,7 @@ import {
} from "react-router-dom";
import { Layout } from "./layout";
import { tools } from "@/components/tool";
// 路由配置
const router = createBrowserRouter([
@@ -15,18 +16,20 @@ const router = createBrowserRouter([
{
path: "tools",
children: [
...tools.map((tool) => (
{
path: tool.name,
element: tool.component,
}
)),
{
index: true,
loader: () => redirect(`/empty`),
element: null,
},
]
},
]
},
{
path: "empty",
element: <div>Nohting</div>,
},
{
index: true,
loader: () => {