|
1 | 1 | /* eslint-disable max-len */
|
2 |
| -import { Tab, Tabs } from '@mui/material'; |
| 2 | +import { Tab, Tabs, Tooltip } from '@mui/material'; |
3 | 3 |
|
4 |
| -import { |
5 |
| - AddBox, |
6 |
| - Groups2, |
7 |
| - AccountBox, |
8 |
| - Settings, |
9 |
| - Menu, |
10 |
| - Memory, |
11 |
| - TabOutlined, |
12 |
| -} from '@mui/icons-material'; |
13 |
| -import { IoMdCube } from 'react-icons/io'; |
| 4 | +import { AddBox, Groups2, Folder } from '@mui/icons-material'; |
14 | 5 | import React from 'react';
|
| 6 | +import TabWithTooltip from './TabWithTooltip'; |
15 | 7 |
|
16 | 8 | interface SidebarProps {
|
17 | 9 | activeTab: number | null;
|
@@ -51,7 +43,7 @@ const Sidebar: React.FC<SidebarProps> = ({
|
51 | 43 | toggleVisibility,
|
52 | 44 | }): JSX.Element => {
|
53 | 45 | const handleTabChange = (event: React.ChangeEvent<{}>, newValue: number) => {
|
54 |
| - setActiveTab(newValue); |
| 46 | + setActiveTab(activeTab === newValue ? null : newValue); |
55 | 47 | toggleVisibility(true);
|
56 | 48 | oldValue = newValue;
|
57 | 49 | };
|
@@ -83,80 +75,36 @@ const Sidebar: React.FC<SidebarProps> = ({
|
83 | 75 | display: 'flex',
|
84 | 76 | flexDirection: 'column',
|
85 | 77 | alignItems: 'center',
|
86 |
| - justifyContent: 'top', |
| 78 | + justifyContent: 'flex-start', |
87 | 79 | gap: '50px',
|
88 | 80 | width: '70px',
|
89 | 81 | background: '#1e2024',
|
90 | 82 | marginRight: '2px',
|
91 | 83 | height: '100vh',
|
| 84 | + position: 'relative', |
92 | 85 | }}
|
93 | 86 | >
|
94 | 87 | <Tab sx={{ position: 'absolute', visibility: 'hidden' }} value={null} />
|
95 |
| - <Tab |
96 |
| - sx={{ |
97 |
| - color: activeTab === 0 ? '#E4E4E5' : '#9C9D9F', |
98 |
| - backgroundColor: activeTab === 0 && '#2D313A', |
99 |
| - '&.Mui-selected': { color: '#E4E4E5' }, |
100 |
| - '&:hover': { color: '#e9e9e9' }, |
101 |
| - fontSize: '11px', |
102 |
| - textTransform: 'none', |
103 |
| - }} |
104 |
| - icon={<AddBox sx={{ fontSize: '26px' }} />} |
105 |
| - value={0} |
106 |
| - label="Canvas" |
107 |
| - /> |
108 |
| - <Tab |
109 |
| - sx={{ |
110 |
| - color: activeTab === 4 ? '#E4E4E5' : '#9C9D9F', |
111 |
| - backgroundColor: activeTab === 4 && '#2D313A', |
112 |
| - '&.Mui-selected': { color: '#E4E4E5' }, |
113 |
| - '&:hover': { color: '#e9e9e9' }, |
114 |
| - fontSize: '11px', |
115 |
| - textTransform: 'none', |
116 |
| - }} |
117 |
| - icon={<TabOutlined sx={{ fontSize: '26px' }} />} |
118 |
| - value={4} |
119 |
| - label="Material UI" |
120 |
| - /> |
121 |
| - <Tab |
122 |
| - sx={{ |
123 |
| - color: activeTab === 1 ? '#E4E4E5' : '#9C9D9F', |
124 |
| - backgroundColor: activeTab === 1 && '#2D313A', |
125 |
| - '&.Mui-selected': { color: '#E4E4E5' }, |
126 |
| - '&:hover': { color: '#e9e9e9' }, |
127 |
| - fontSize: '11px', |
128 |
| - textTransform: 'none', |
129 |
| - }} |
130 |
| - icon={<IoMdCube style={{ fontSize: '25px' }} />} |
131 |
| - value={1} |
132 |
| - label="Create" |
133 |
| - /> |
134 |
| - <Tab |
135 |
| - sx={{ |
136 |
| - color: activeTab === 2 ? '#E4E4E5' : '#9C9D9F', |
137 |
| - backgroundColor: activeTab === 2 && '#2D313A', |
138 |
| - '&.Mui-selected': { color: '#E4E4E5' }, |
139 |
| - '&:hover': { color: '#e9e9e9' }, |
140 |
| - fontSize: '11px', |
141 |
| - textTransform: 'none', |
142 |
| - }} |
143 |
| - icon={<Groups2 sx={{ fontSize: '28px' }} />} |
144 |
| - value={2} |
145 |
| - label="Collab" |
146 |
| - /> |
147 |
| - <Tab |
148 |
| - sx={{ |
149 |
| - color: activeTab === 3 ? '#E4E4E5' : '#9C9D9F', |
150 |
| - backgroundColor: activeTab === 3 && '#2D313A', |
151 |
| - '&.Mui-selected': { color: '#E4E4E5' }, |
152 |
| - '&:hover': { color: '#e9e9e9' }, |
153 |
| - fontSize: '11px', |
154 |
| - textTransform: 'none', |
155 |
| - }} |
156 |
| - icon={<AccountBox sx={{ fontSize: '26px' }} />} |
157 |
| - value={3} |
158 |
| - label="Profile" |
159 |
| - /> |
| 88 | + <div> |
| 89 | + <TabWithTooltip |
| 90 | + label="Modules" |
| 91 | + value={0} |
| 92 | + activeTab={activeTab} |
| 93 | + handleTabChange={handleTabChange} |
| 94 | + /> |
| 95 | + <TabWithTooltip |
| 96 | + label="Create" |
| 97 | + value={1} |
| 98 | + activeTab={activeTab} |
| 99 | + handleTabChange={handleTabChange} |
| 100 | + /> |
| 101 | + <TabWithTooltip |
| 102 | + label="Collab" |
| 103 | + value={2} |
| 104 | + activeTab={activeTab} |
| 105 | + handleTabChange={handleTabChange} |
| 106 | + /> |
| 107 | + </div> |
160 | 108 | </Tabs>
|
161 | 109 | );
|
162 | 110 | };
|
|
0 commit comments