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