malavikapradeep2001 commited on
Commit
0d67b60
·
unverified ·
1 Parent(s): 5358512

Update frontend/src/components/Sidebar.tsx

Browse files
Files changed (1) hide show
  1. frontend/src/components/Sidebar.tsx +78 -46
frontend/src/components/Sidebar.tsx CHANGED
@@ -1,4 +1,12 @@
1
- import { FileTextIcon, HelpCircleIcon } from 'lucide-react';
 
 
 
 
 
 
 
 
2
 
3
  interface SidebarProps {
4
  selectedTest: string;
@@ -6,57 +14,81 @@ interface SidebarProps {
6
  }
7
 
8
  export function Sidebar({ selectedTest, onTestChange }: SidebarProps) {
 
 
9
  const testTypes = [
10
- { value: 'cytology', label: 'Cytology Analysis' },
11
- { value: 'colposcopy', label: 'Colposcopy Analysis' },
12
- { value: 'histopathology', label: 'Histopathology Analysis' },
13
  ];
14
 
15
  return (
16
- <aside className="w-64 bg-white border-r border-gray-200 p-4">
17
- <div className="space-y-4">
18
- {/* Gradient Header */}
19
- <h3 className="text-lg font-semibold text-white mb-3 px-3 py-2 rounded-md bg-gradient-to-r from-blue-800 to-teal-600 shadow-sm">
20
- New Test
21
- </h3>
22
-
23
- {/* Test Selection */}
24
- <div className="flex flex-col gap-2">
25
- {testTypes.map((test) => (
26
- <label
27
- key={test.value}
28
- className={`flex items-center gap-3 px-3 py-2 rounded-lg cursor-pointer border transition-all duration-200
29
- ${
30
- selectedTest === test.value
31
- ? 'border-blue-600 bg-blue-50 text-blue-900 font-medium shadow-sm'
32
- : 'border-gray-200 hover:border-blue-300 hover:bg-gray-50 text-gray-700'
33
- }`}
34
- >
35
- <input
36
- type="radio"
37
- name="testType"
38
- value={test.value}
39
- checked={selectedTest === test.value}
40
- onChange={() => onTestChange(test.value)}
41
- className="form-radio h-4 w-4 text-blue-600 focus:ring-blue-500"
42
- />
43
- <span>{test.label}</span>
44
- </label>
45
- ))}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  </div>
47
 
48
- {/* History */}
49
- <button className="w-full flex items-center gap-3 px-4 py-3 text-gray-700 hover:bg-gray-50 rounded-lg transition-colors">
50
- <FileTextIcon className="w-5 h-5" />
51
- <span>History</span>
52
- </button>
53
-
54
- {/* Help */}
55
- <button className="w-full flex items-center gap-3 px-4 py-3 text-gray-700 hover:bg-gray-50 rounded-lg transition-colors">
56
- <HelpCircleIcon className="w-5 h-5" />
57
- <span>Help</span>
58
- </button>
 
 
 
 
59
  </div>
60
  </aside>
61
  );
62
- }
 
1
+ import { useState } from "react";
2
+ import {
3
+ FileTextIcon,
4
+ HelpCircleIcon,
5
+ PlusCircle,
6
+ ChevronDown,
7
+ ChevronRight,
8
+ } from "lucide-react";
9
+ import { Microscope, Stethoscope, FlaskConical } from "lucide-react";
10
 
11
  interface SidebarProps {
12
  selectedTest: string;
 
14
  }
15
 
16
  export function Sidebar({ selectedTest, onTestChange }: SidebarProps) {
17
+ const [isTestOpen, setIsTestOpen] = useState(true);
18
+
19
  const testTypes = [
20
+ { value: "cytology", label: "Cytology Analysis", icon: Microscope },
21
+ { value: "colposcopy", label: "Colposcopy Analysis", icon: Stethoscope },
22
+ { value: "histopathology", label: "Histopathology Analysis", icon: FlaskConical },
23
  ];
24
 
25
  return (
26
+ <aside className="w-72 h-screen bg-white border-r border-gray-200 p-4 flex flex-col justify-between">
27
+ <div className="space-y-2">
28
+ {/* --- Start New Test Dropdown --- */}
29
+ <div>
30
+ <button
31
+ onClick={() => setIsTestOpen(!isTestOpen)}
32
+ className="flex items-center justify-between w-full px-3 py-3 rounded-lg hover:bg-gray-50 transition-colors text-gray-800 font-semibold"
33
+ >
34
+ <div className="flex items-center gap-3">
35
+ <PlusCircle className="w-5 h-5 text-teal-600" />
36
+ <span>Start New Test</span>
37
+ </div>
38
+ {isTestOpen ? (
39
+ <ChevronDown className="w-5 h-5 text-gray-500" />
40
+ ) : (
41
+ <ChevronRight className="w-5 h-5 text-gray-500" />
42
+ )}
43
+ </button>
44
+
45
+ {isTestOpen && (
46
+ <div className="mt-1 ml-6 space-y-1">
47
+ {testTypes.map(({ value, label, icon: Icon }) => (
48
+ <button
49
+ key={value}
50
+ onClick={() => onTestChange(value)}
51
+ className={`flex items-center w-full gap-3 px-3 py-2 rounded-md text-sm transition-all duration-200
52
+ ${
53
+ selectedTest === value
54
+ ? "bg-gradient-to-r from-teal-700 to-teal-600 text-white font-medium shadow-sm"
55
+ : "text-gray-700 hover:bg-gray-50"
56
+ }`}
57
+ >
58
+ <Icon
59
+ className={`w-4 h-4 ${
60
+ selectedTest === value ? "text-white" : "text-gray-500"
61
+ }`}
62
+ />
63
+ <span
64
+ className={`${
65
+ selectedTest === value ? "text-white" : "text-gray-700"
66
+ }`}
67
+ >
68
+ {label}
69
+ </span>
70
+ </button>
71
+ ))}
72
+ </div>
73
+ )}
74
  </div>
75
 
76
+ {/* --- Divider --- */}
77
+ <hr className="border-gray-200 my-4" />
78
+
79
+ {/* --- Other Options --- */}
80
+ <div>
81
+ <button className="w-full flex items-center gap-3 px-3 py-3 text-gray-700 hover:bg-gray-50 rounded-lg transition-colors">
82
+ <FileTextIcon className="w-5 h-5 text-gray-500" />
83
+ <span>History</span>
84
+ </button>
85
+
86
+ <button className="w-full flex items-center gap-3 px-3 py-3 text-gray-700 hover:bg-gray-50 rounded-lg transition-colors">
87
+ <HelpCircleIcon className="w-5 h-5 text-gray-500" />
88
+ <span>Help</span>
89
+ </button>
90
+ </div>
91
  </div>
92
  </aside>
93
  );
94
+ }