@@ -9,7 +9,7 @@ import Cross1 from '@/components/radix/cross1';
99import NodeButton from './node-button' ;
1010import React , { useState } from 'react' ;
1111import { Input } from '@/components/ui/input' ;
12- import { MagnifyingGlassIcon } from '@radix-ui/ react-icons ' ;
12+ import { ChevronDown } from 'lucide- react' ;
1313
1414
1515export default function Sidebar ( ) {
@@ -42,6 +42,7 @@ export default function Sidebar() {
4242 ] ;
4343
4444 const [ searchTerm , setSearchTerm ] = useState ( '' ) ;
45+ const [ collapsed , setCollapsed ] = useState ( false ) ;
4546
4647 const filteredNodes = AvailableNodes . filter ( ( node ) =>
4748 node . label . toLowerCase ( ) . includes ( searchTerm . toLowerCase ( ) )
@@ -53,32 +54,42 @@ export default function Sidebar() {
5354 < Card className = "max-h-[calc(100vh-2rem)] flex flex-col " >
5455 < CardHeader className = "flex flex-row items-center justify-between pb-4" >
5556 < CardTitle className = "font-ibmplex font-semibold text-xl text-black" > Menu</ CardTitle >
56- < Cross1 />
57+ < button
58+ onClick = { ( ) => setCollapsed ( ! collapsed ) }
59+ className = "p-1 rounded hover:bg-gray-100"
60+ aria-label = { collapsed ? 'Expand menu' : 'Collapse menu' }
61+ >
62+ { collapsed ? < ChevronDown size = { 15 } /> : < Cross1 /> }
63+ </ button >
5764 </ CardHeader >
5865
59- < div className = 'pb-4' >
60- < Input
61- type = "text"
62- placeholder = "Search"
63- value = { searchTerm }
64- onChange = { ( e ) => setSearchTerm ( e . target . value ) }
65- className = "items-center px-7 py-2 mx-4 border border-gray-200 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 text-gray-700 placeholder-gray-500"
66- />
67- </ div >
66+ { ! collapsed && (
67+ < >
68+ < div className = 'pb-4' >
69+ < Input
70+ type = "text"
71+ placeholder = "Search"
72+ value = { searchTerm }
73+ onChange = { ( e ) => setSearchTerm ( e . target . value ) }
74+ className = "items-center px-7 py-2 mx-4 border border-gray-200 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 text-gray-700 placeholder-gray-500"
75+ />
76+ </ div >
6877
69- < CardContent className = "overflow-y-auto flex-1 px-4 pb-4 space-y-3" >
70- { ( searchTerm ? filteredNodes : AvailableNodes ) . map ( ( node ) => (
71- < NodeButton
72- key = { node . id }
73- id = { node . id }
74- label = { node . label }
75- description = { node . description }
76- />
77- ) ) }
78- </ CardContent >
78+ < CardContent className = "overflow-y-auto flex-1 px-4 pb-4 space-y-3" >
79+ { ( searchTerm ? filteredNodes : AvailableNodes ) . map ( ( node ) => (
80+ < NodeButton
81+ key = { node . id }
82+ id = { node . id }
83+ label = { node . label }
84+ description = { node . description }
85+ />
86+ ) ) }
87+ </ CardContent >
88+ </ >
89+ ) }
7990 </ Card >
8091 </ ResizablePanel >
81- < ResizableHandle withHandle className = " bg-border-none" />
92+ < ResizableHandle withHandle className = { collapsed ? 'invisible' : ' bg-border-none' } />
8293 < ResizablePanel defaultSize = { 40 } minSize = { 5 } />
8394 </ ResizablePanelGroup >
8495 ) ;
0 commit comments