feat(react-web-next): 新增.editorconfig和.prettierrc配置文件,添加public/.gitkeep占位文件
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import React from 'react';
|
||||
import { Button, Tooltip } from 'antd';
|
||||
import { MoonOutlined, SunOutlined } from '@ant-design/icons';
|
||||
import type { ThemeMode } from '@/theme';
|
||||
|
||||
export interface ThemeSwitchProps {
|
||||
mode: ThemeMode;
|
||||
onToggle: () => void;
|
||||
}
|
||||
|
||||
const ThemeSwitch: React.FC<ThemeSwitchProps> = ({ mode, onToggle }) => {
|
||||
return (
|
||||
<Tooltip title={mode === 'dark' ? '切换为亮色' : '切换为暗色'}>
|
||||
<Button
|
||||
type="text"
|
||||
onClick={onToggle}
|
||||
icon={mode === 'dark' ? <SunOutlined /> : <MoonOutlined />}
|
||||
style={{ color: 'var(--text-primary)' }}
|
||||
>
|
||||
{mode === 'dark' ? '亮色' : '暗色'}
|
||||
</Button>
|
||||
</Tooltip>
|
||||
);
|
||||
};
|
||||
|
||||
export default ThemeSwitch;
|
||||
|
||||
Reference in New Issue
Block a user