Skip to content

Commit a5d6063

Browse files
committed
feat(Header): enhance mobile layout with dedicated buttons and improved responsiveness
1 parent e640266 commit a5d6063

1 file changed

Lines changed: 57 additions & 51 deletions

File tree

  • web/src/pages/FileExplorerPage/components

web/src/pages/FileExplorerPage/components/Header.tsx

Lines changed: 57 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -182,71 +182,77 @@ export const Header: React.FC<HeaderProps> = ({
182182
},
183183
};
184184

185+
if (isMobile) {
186+
return (
187+
<Flex align="center" gap={6} style={{ padding: '10px 12px', borderBottom: `1px solid ${token.colorBorderSecondary}`, minWidth: 0 }}>
188+
<Button size="small" icon={<ArrowUpOutlined />} onClick={onGoUp} disabled={path === '/'} />
189+
{renderBreadcrumb()}
190+
<Space size={4} style={{ flexShrink: 0 }}>
191+
<Button size="small" icon={<ReloadOutlined />} onClick={onRefresh} loading={loading} aria-label={t('Refresh')} />
192+
<Button size="small" icon={<PlusOutlined />} onClick={onCreateDir} aria-label={t('New Folder')} />
193+
<Button size="small" icon={<UploadOutlined />} onClick={onUploadFile} aria-label={t('Upload Files')} />
194+
<Dropdown menu={{ items: mobileMoreItems }}>
195+
<Button size="small" icon={<MoreOutlined />} aria-label={t('More')} />
196+
</Dropdown>
197+
</Space>
198+
</Flex>
199+
);
200+
}
201+
185202
return (
186-
<Flex vertical={isMobile} gap={isMobile ? 10 : 12} style={{ padding: isMobile ? '10px 12px' : '10px 16px', borderBottom: `1px solid ${token.colorBorderSecondary}` }}>
203+
<Flex vertical gap={12} style={{ padding: '10px 16px', borderBottom: `1px solid ${token.colorBorderSecondary}` }}>
187204
<Flex align="center" gap={8} style={{ minWidth: 0 }}>
188205
<Button size="small" icon={<ArrowUpOutlined />} onClick={onGoUp} disabled={path === '/'} />
189-
{!isMobile && <Typography.Text strong>{t('File Manager')}</Typography.Text>}
190-
{!isMobile && <Divider type="vertical" />}
206+
<Typography.Text strong>{t('File Manager')}</Typography.Text>
207+
<Divider type="vertical" />
191208
{renderBreadcrumb()}
192209
</Flex>
193210

194211
<Flex align="center" justify="space-between" gap={8} style={{ flexWrap: 'wrap' }}>
195212
<Space size={8} wrap>
196213
<Button size="small" icon={<ReloadOutlined />} onClick={onRefresh} loading={loading} aria-label={t('Refresh')}>
197-
{!isMobile && t('Refresh')}
214+
{t('Refresh')}
198215
</Button>
199216
<Button size="small" icon={<PlusOutlined />} onClick={onCreateDir} aria-label={t('New Folder')}>
200-
{!isMobile && t('New Folder')}
217+
{t('New Folder')}
201218
</Button>
202-
{isMobile ? (
203-
<Button size="small" icon={<UploadOutlined />} onClick={onUploadFile} aria-label={t('Upload Files')} />
204-
) : (
205-
<Dropdown.Button
206-
size="small"
207-
icon={<UploadOutlined />}
208-
onClick={onUploadFile}
209-
menu={uploadMenu}
210-
>
211-
{t('Upload')}
212-
</Dropdown.Button>
213-
)}
214-
{isMobile && (
215-
<Dropdown menu={{ items: mobileMoreItems }}>
216-
<Button size="small" icon={<MoreOutlined />} aria-label={t('More')} />
217-
</Dropdown>
218-
)}
219+
<Dropdown.Button
220+
size="small"
221+
icon={<UploadOutlined />}
222+
onClick={onUploadFile}
223+
menu={uploadMenu}
224+
>
225+
{t('Upload')}
226+
</Dropdown.Button>
219227
</Space>
220228

221-
{!isMobile && (
222-
<Space size={8} wrap>
223-
<Select
224-
size="small"
225-
value={sortBy}
226-
onChange={(val) => onSortChange(val, sortOrder)}
227-
style={{ width: 112 }}
228-
options={[
229-
{ value: 'name', label: t('Name') },
230-
{ value: 'size', label: t('Size') },
231-
{ value: 'mtime', label: t('Modified Time') },
232-
]}
233-
/>
234-
<Button
235-
size="small"
236-
icon={sortOrder === 'asc' ? <ArrowUpOutlined /> : <ArrowDownOutlined />}
237-
onClick={() => onSortChange(sortBy, sortOrder === 'asc' ? 'desc' : 'asc')}
238-
/>
239-
<Segmented
240-
size="small"
241-
value={viewMode}
242-
onChange={(value) => onSetViewMode(value as ViewMode)}
243-
options={[
244-
{ label: <Tooltip title={t('Grid')}><AppstoreOutlined /></Tooltip>, value: 'grid' },
245-
{ label: <Tooltip title={t('List')}><UnorderedListOutlined /></Tooltip>, value: 'list' },
246-
]}
247-
/>
248-
</Space>
249-
)}
229+
<Space size={8} wrap>
230+
<Select
231+
size="small"
232+
value={sortBy}
233+
onChange={(val) => onSortChange(val, sortOrder)}
234+
style={{ width: 112 }}
235+
options={[
236+
{ value: 'name', label: t('Name') },
237+
{ value: 'size', label: t('Size') },
238+
{ value: 'mtime', label: t('Modified Time') },
239+
]}
240+
/>
241+
<Button
242+
size="small"
243+
icon={sortOrder === 'asc' ? <ArrowUpOutlined /> : <ArrowDownOutlined />}
244+
onClick={() => onSortChange(sortBy, sortOrder === 'asc' ? 'desc' : 'asc')}
245+
/>
246+
<Segmented
247+
size="small"
248+
value={viewMode}
249+
onChange={(value) => onSetViewMode(value as ViewMode)}
250+
options={[
251+
{ label: <Tooltip title={t('Grid')}><AppstoreOutlined /></Tooltip>, value: 'grid' },
252+
{ label: <Tooltip title={t('List')}><UnorderedListOutlined /></Tooltip>, value: 'list' },
253+
]}
254+
/>
255+
</Space>
250256
</Flex>
251257
</Flex>
252258
);

0 commit comments

Comments
 (0)