Skip to content

Commit 33d3f6a

Browse files
authored
Move from Antd.List to standard HTML list (#350)
1 parent 65dbc95 commit 33d3f6a

File tree

1 file changed

+49
-18
lines changed

1 file changed

+49
-18
lines changed

src/reactComponents/AddTabDialog.tsx

Lines changed: 49 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -163,28 +163,59 @@ export default function AddTabDialog(props: AddTabDialogProps) {
163163
<h4 style={{margin: '0 0 8px 0'}}>
164164
{t('SELECT_HIDDEN')}
165165
</h4>
166-
<Antd.List
167-
size="small"
168-
bordered
169-
style={{height: getListHeight(), overflow: 'auto', marginBottom: 16}}
170-
dataSource={availableItems}
171-
renderItem={(item) => (
172-
<Antd.List.Item
173-
onClick={() => handleSelectModule(item)}
174-
style={{cursor: 'pointer'}}
175-
>
176-
<Antd.List.Item.Meta
177-
avatar={TabTypeUtils.getIcon(item.type)}
178-
title={
166+
<div
167+
style={{
168+
height: getListHeight(),
169+
overflow: 'auto',
170+
marginBottom: 16,
171+
border: `1px solid ${token.colorBorder}`,
172+
borderRadius: '6px',
173+
}}
174+
>
175+
{availableItems.length === 0 ? (
176+
<div style={{
177+
padding: '20px',
178+
textAlign: 'center',
179+
color: token.colorTextSecondary,
180+
}}>
181+
{tabType === TabType.MECHANISM ? t('NO_HIDDEN_MECHANISMS') : t('NO_HIDDEN_OPMODES')}
182+
</div>
183+
) : (
184+
<ul style={{
185+
listStyle: 'none',
186+
margin: 0,
187+
padding: 0,
188+
}}>
189+
{availableItems.map((item) => (
190+
<li
191+
key={item.path}
192+
onClick={() => handleSelectModule(item)}
193+
style={{
194+
cursor: 'pointer',
195+
padding: '12px 16px',
196+
borderBottom: `1px solid ${token.colorBorderSecondary}`,
197+
display: 'flex',
198+
alignItems: 'center',
199+
gap: '12px',
200+
}}
201+
onMouseEnter={(e) => {
202+
e.currentTarget.style.backgroundColor = token.colorBgTextHover;
203+
}}
204+
onMouseLeave={(e) => {
205+
e.currentTarget.style.backgroundColor = 'transparent';
206+
}}
207+
>
208+
<span style={{ display: 'flex', alignItems: 'center' }}>
209+
{TabTypeUtils.getIcon(item.type)}
210+
</span>
179211
<span style={{fontSize: '14px'}}>
180212
{item.title}
181213
</span>
182-
}
183-
/>
184-
</Antd.List.Item>
214+
</li>
215+
))}
216+
</ul>
185217
)}
186-
locale={{emptyText: tabType === TabType.MECHANISM ? t('NO_HIDDEN_MECHANISMS') : t('NO_HIDDEN_OPMODES')}}
187-
/>
218+
</div>
188219
<h4 style={{margin: '0 0 8px 0'}}>
189220
{t('CREATE_NEW', { type: TabTypeUtils.toString(tabType) })}
190221
</h4>

0 commit comments

Comments
 (0)