rewrite nav
This commit is contained in:
parent
6249a0aba7
commit
5341fe58d0
18 changed files with 254 additions and 415 deletions
51
src/components/navigation/sidebars/nav/RootNav.astro
Normal file
51
src/components/navigation/sidebars/nav/RootNav.astro
Normal file
|
@ -0,0 +1,51 @@
|
|||
---
|
||||
export interface Props {
|
||||
currentRoute: string;
|
||||
currentModule: string;
|
||||
currentClass: string;
|
||||
}
|
||||
|
||||
const { currentRoute, currentModule, currentClass } = Astro.props;
|
||||
|
||||
import { generateTypeData } from "@config/io/generateTypeData";
|
||||
import { groupRoutes } from "@config/io/helpers";
|
||||
import Tree from "./Tree.astro";
|
||||
|
||||
const routes = await generateTypeData();
|
||||
const groupedRoutes = groupRoutes(routes);
|
||||
|
||||
const configuration = {
|
||||
title: "Configuration",
|
||||
link: "/docs/configuration",
|
||||
current: currentRoute.startsWith("configuration"),
|
||||
entries: groupedRoutes.tutorials.configuration.map(
|
||||
({ name, type }) => ({
|
||||
title: name,
|
||||
link: `/docs/configuration/${type}`,
|
||||
current: currentModule === type,
|
||||
})
|
||||
),
|
||||
};
|
||||
|
||||
const types = {
|
||||
title: "Quickshell Types",
|
||||
link: "/docs/types",
|
||||
current: currentRoute.startsWith("types"),
|
||||
entries: Object.entries(groupedRoutes.types).map(
|
||||
([module, items]) => ({
|
||||
title: module,
|
||||
link: `/docs/types/${module}`,
|
||||
current: currentModule === module,
|
||||
entries: items.map(type => ({
|
||||
title: type.name,
|
||||
link: `/docs/types/${module}/${type.name}`,
|
||||
current: currentClass === type.name,
|
||||
})),
|
||||
})
|
||||
),
|
||||
};
|
||||
---
|
||||
<nav class="navtree">
|
||||
<Tree {...configuration}/>
|
||||
<Tree {...types}/>
|
||||
</nav>
|
Loading…
Add table
Add a link
Reference in a new issue