|
1 | | -import React from 'react'; |
| 1 | +import React, { useState } from 'react'; |
2 | 2 | import { ListItemIcon } from '../../base'; |
3 | 3 | import { useTheme } from '../../theme'; |
4 | 4 | import CollapsibleSection from './CollapsibleSection'; |
5 | 5 | import { LabelDiv } from './style'; |
6 | 6 |
|
7 | 7 | interface TechnologySectionProps { |
8 | | - availableTechnologies: string[]; |
9 | | - openTechnologies: boolean; |
10 | | - handleOpenTechnologies: () => void; |
| 8 | + technologies: string[]; |
11 | 9 | technologySVGPath: string; |
12 | 10 | technologySVGSubpath: string; |
13 | 11 | } |
14 | 12 |
|
15 | 13 | const TechnologySection: React.FC<TechnologySectionProps> = ({ |
16 | | - availableTechnologies, |
17 | | - openTechnologies, |
18 | | - handleOpenTechnologies, |
19 | 14 | technologySVGPath, |
20 | | - technologySVGSubpath |
| 15 | + technologySVGSubpath, |
| 16 | + technologies |
21 | 17 | }) => { |
| 18 | + const [openTechnologies, setOpenTechnologies] = useState(true); |
| 19 | + |
22 | 20 | const theme = useTheme(); |
23 | 21 |
|
24 | 22 | const renderTechnologyItem = (item: string, index: number) => { |
@@ -47,8 +45,8 @@ const TechnologySection: React.FC<TechnologySectionProps> = ({ |
47 | 45 | <CollapsibleSection |
48 | 46 | title="TECHNOLOGY" |
49 | 47 | isOpen={openTechnologies} |
50 | | - onToggle={handleOpenTechnologies} |
51 | | - items={availableTechnologies} |
| 48 | + onToggle={() => setOpenTechnologies((prev) => !prev)} |
| 49 | + items={technologies} |
52 | 50 | renderItem={renderTechnologyItem} |
53 | 51 | emptyState={'No technologies assigned to this design'} |
54 | 52 | tooltip={'Technologies used in this design'} |
|
0 commit comments