框架优化
This commit is contained in:
@@ -3,8 +3,7 @@ import { Layout, Switch, Button, Dropdown } from 'antd';
|
||||
import { UserOutlined, LogoutOutlined } from '@ant-design/icons';
|
||||
import { useTheme } from '@/contexts/ThemeContext';
|
||||
import { useAuth } from '@/contexts/AuthContext';
|
||||
import { MenuTrigger } from '../common/MenuTrigger';
|
||||
|
||||
import { MenuTrigger } from '../Layout/MenuTrigger';
|
||||
const { Header: AntHeader } = Layout;
|
||||
|
||||
const Header = ({ collapsed, setCollapsed }) => {
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
import React from 'react';
|
||||
import { RocketOutlined } from '@ant-design/icons';
|
||||
import { Typography } from 'antd';
|
||||
|
||||
const { Text } = Typography;
|
||||
|
||||
export const Logo = ({ collapsed, isDarkMode }) => (
|
||||
<div className="logo">
|
||||
<div className="flex items-center justify-center gap-2">
|
||||
<RocketOutlined className="text-2xl text-primary-500" />
|
||||
{!collapsed && (
|
||||
<h1 className="text-lg font-semibold m-0" style={{
|
||||
background: 'var(--primary-gradient)',
|
||||
WebkitBackgroundClip: 'text',
|
||||
WebkitTextFillColor: 'transparent'
|
||||
}}>
|
||||
<Text className="text-lg font-semibold m-0" style={{ color: 'var(--primary-color)' }}>
|
||||
Uppeta
|
||||
</h1>
|
||||
</Text>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Layout, Menu } from 'antd';
|
||||
import { useNavigate, useLocation } from 'react-router-dom';
|
||||
import { useTheme } from '@/contexts/ThemeContext';
|
||||
import { getMenuItems } from '@/utils/menuUtils';
|
||||
import { Logo } from '@/components/common/Logo';
|
||||
import { Logo } from '@/components/Layout/Logo';
|
||||
|
||||
const { Sider } = Layout;
|
||||
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
import React from 'react';
|
||||
import { Table } from 'antd';
|
||||
|
||||
export const BaseTable = ({
|
||||
columns,
|
||||
dataSource,
|
||||
loading = false,
|
||||
rowKey = 'id',
|
||||
...props
|
||||
}) => (
|
||||
<Table
|
||||
columns={columns}
|
||||
dataSource={dataSource}
|
||||
loading={loading}
|
||||
rowKey={rowKey}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
@@ -1,17 +0,0 @@
|
||||
import React from 'react';
|
||||
|
||||
export const Icon = ({ name, className = '', style = {} }) => (
|
||||
<span
|
||||
className={`material-symbols-rounded ${className}`}
|
||||
style={{
|
||||
fontSize: '20px',
|
||||
background: 'var(--primary-gradient)',
|
||||
WebkitBackgroundClip: 'text',
|
||||
WebkitTextFillColor: 'transparent',
|
||||
fontVariationSettings: "'FILL' 1, 'wght' 400, 'GRAD' 200, 'opsz' 20",
|
||||
...style
|
||||
}}
|
||||
>
|
||||
{name}
|
||||
</span>
|
||||
);
|
||||
@@ -1,21 +0,0 @@
|
||||
import React from 'react';
|
||||
|
||||
export const Logo = ({ collapsed, isDarkMode }) => (
|
||||
<div className="logo">
|
||||
<div className="flex items-center justify-center gap-2">
|
||||
<span className="material-symbols-rounded text-primary-500">
|
||||
rocket_launch
|
||||
</span>
|
||||
<h1
|
||||
style={{
|
||||
color: isDarkMode ? '#fff' : '#000',
|
||||
fontSize: collapsed ? '14px' : '18px',
|
||||
margin: 0,
|
||||
display: collapsed ? 'none' : 'block',
|
||||
}}
|
||||
>
|
||||
Uppeta
|
||||
</h1>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
@@ -1,14 +0,0 @@
|
||||
import React from 'react';
|
||||
import { Button } from 'antd';
|
||||
import { PlusOutlined } from '@ant-design/icons';
|
||||
|
||||
export const PageHeader = ({ title, onAdd, addButtonText = '新增' }) => (
|
||||
<div className="flex justify-between items-center mb-4">
|
||||
<h1 className="text-2xl font-bold">{title}</h1>
|
||||
{onAdd && (
|
||||
<Button type="primary" icon={<PlusOutlined />} onClick={onAdd}>
|
||||
{addButtonText}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
Reference in New Issue
Block a user