Files
aurora-admin/site/sources/themeswitcher/jsx.txt
T
aurora-admin c65a69c34e
Deploy to GitHub Pages / deploy (push) Failing after 16s
Regression / regression (push) Failing after 15m2s
feat(P4): precompute移植+app.js sources双向回填+回归1003/1003+验收体积/文件/data.json
2026-09-12 14:18:41 +08:00

37 lines
1.1 KiB
Plaintext

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>
);
}