mirror of
https://github.com/dergigi/boris.git
synced 2025-12-27 19:44:40 +01:00
- Extract ColorPicker component from Settings - Extract FontSelector component from Settings - Move hexToRgb helper to colorHelpers utils - Export HIGHLIGHT_COLORS constant from colorHelpers - Settings.tsx now 209 lines (was 242) - ContentPanel.tsx now 197 lines (was 204) Keeps code DRY and improves maintainability
27 lines
738 B
TypeScript
27 lines
738 B
TypeScript
import React from 'react'
|
|
import { HIGHLIGHT_COLORS } from '../utils/colorHelpers'
|
|
|
|
interface ColorPickerProps {
|
|
selectedColor: string
|
|
onColorChange: (color: string) => void
|
|
}
|
|
|
|
const ColorPicker: React.FC<ColorPickerProps> = ({ selectedColor, onColorChange }) => {
|
|
return (
|
|
<div className="color-picker">
|
|
{HIGHLIGHT_COLORS.map(color => (
|
|
<button
|
|
key={color.value}
|
|
onClick={() => onColorChange(color.value)}
|
|
className={`color-swatch ${selectedColor === color.value ? 'active' : ''}`}
|
|
style={{ backgroundColor: color.value }}
|
|
title={color.name}
|
|
aria-label={`${color.name} highlight color`}
|
|
/>
|
|
))}
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default ColorPicker
|