Aurora Admin v1.2.0: 79 components x 5 ends, doc site, contracts batch 1, playground, regression, deploy ready
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import React from 'react';
|
||||
import './ThemeSwitcher.css';
|
||||
|
||||
const MODES = [
|
||||
{ value: 'light', label: '浅色' },
|
||||
{ value: 'dark', label: '深色' }
|
||||
];
|
||||
const BRANDS = ['#2F54EB', '#1677FF', '#722ED1', '#13C2C2', '#FA541C', '#EB2F96'];
|
||||
|
||||
export default function ThemeSwitcher({ mode = 'light', brand = '#2F54EB', onModeChange, onBrandChange }) {
|
||||
return (
|
||||
<div className="aa-themesw">
|
||||
{MODES.map((m) => (
|
||||
<div
|
||||
key={m.value}
|
||||
className={'aa-themesw-opt' + (mode === m.value ? ' is-active' : '')}
|
||||
onClick={() => onModeChange && onModeChange(m.value)}
|
||||
>
|
||||
<span className={'aa-themesw-dot ' + m.value} />
|
||||
{m.label}
|
||||
</div>
|
||||
))}
|
||||
<div className="aa-themesw-colors">
|
||||
{BRANDS.map((c) => (
|
||||
<span
|
||||
key={c}
|
||||
className={'aa-themesw-color' + (brand === c ? ' is-active' : '')}
|
||||
style={{ background: c }}
|
||||
onClick={() => onBrandChange && onBrandChange(c)}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
<div className="aa-themesw-label">品牌色:{brand}(应用于 CSS 变量 --brand 实时预览)</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user