@@ -4,37 +4,25 @@ import {
4
4
onMount ,
5
5
onCleanup ,
6
6
type Component ,
7
+ type JSXElement ,
7
8
} from "solid-js" ;
8
9
9
- import { LoadingSpinner , MenuToX , XToMenu } from "@icons" ;
10
- import { Tree } from "./Tree" ;
11
- import type { NavProps } from "../types" ;
10
+ import { MenuToX , XToMenu } from "@icons" ;
12
11
13
- const NavComponent : Component < NavProps > = props => {
12
+ export interface SidebarContent {
13
+ children : JSXElement ;
14
+ }
15
+
16
+ const NavComponent : Component < SidebarContent > = props => {
14
17
const [ open , setOpen ] = createSignal < boolean > ( false ) ;
15
- const { tree , mobile , routes } = props ;
18
+ const { children } = props ;
16
19
let navRef : HTMLDivElement ;
17
20
18
- if ( ! tree ) {
19
- return < LoadingSpinner /> ;
20
- }
21
-
22
21
function toggle ( e : MouseEvent ) {
23
22
e . preventDefault ( ) ;
24
23
setOpen ( ! open ( ) ) ;
25
24
}
26
25
27
- if ( ! mobile ) {
28
- return (
29
- < Tree
30
- currentRoute = { tree . currentRoute }
31
- currentModule = { tree . currentModule || null }
32
- currentClass = { tree . currentClass || null }
33
- items = { routes }
34
- />
35
- ) ;
36
- }
37
-
38
26
const handleClickOutside = ( event : MouseEvent ) => {
39
27
const isLink = "href" in ( event . target || { } ) ;
40
28
const isInBody = document . body . contains ( event . target as Node ) ;
@@ -78,12 +66,7 @@ const NavComponent: Component<NavProps> = props => {
78
66
id = { open ( ) ? "#qs_search" : "" }
79
67
class = { `nav-items ${ open ( ) ? "shown" : "" } ` }
80
68
>
81
- < Tree
82
- currentRoute = { tree . currentRoute }
83
- currentModule = { tree . currentModule }
84
- currentClass = { tree . currentClass }
85
- items = { routes }
86
- />
69
+ { children }
87
70
</ div >
88
71
</ div >
89
72
) ;
0 commit comments