diff --git a/app/soapbox/features/theme-editor/index.tsx b/app/soapbox/features/theme-editor/index.tsx index 2cf081ea4..0bd4741ff 100644 --- a/app/soapbox/features/theme-editor/index.tsx +++ b/app/soapbox/features/theme-editor/index.tsx @@ -9,12 +9,15 @@ import { fetchSoapboxConfig } from 'soapbox/actions/soapbox'; import List, { ListItem } from 'soapbox/components/list'; import { Button, Column, Form, FormActions } from 'soapbox/components/ui'; import DropdownMenuContainer from 'soapbox/containers/dropdown-menu-container'; +import ColorWithPicker from 'soapbox/features/soapbox-config/components/color-with-picker'; import { useAppDispatch, useAppSelector, useSoapboxConfig } from 'soapbox/hooks'; import { normalizeSoapboxConfig } from 'soapbox/normalizers'; import { download } from 'soapbox/utils/download'; import Palette, { ColorGroup } from './components/palette'; +import type { ColorChangeHandler } from 'react-color'; + const messages = defineMessages({ title: { id: 'admin.theme.title', defaultMessage: 'Theme' }, saved: { id: 'theme_editor.saved', defaultMessage: 'Theme updated!' }, @@ -54,6 +57,15 @@ const ThemeEditor: React.FC = () => { }; }; + const updateColor = (key: string) => { + return (hex: string) => { + setColors({ + ...colors, + [key]: hex, + }); + }; + }; + const setTheme = (theme: any) => { setResetKey(uuidv4()); setTimeout(() => setColors(theme)); @@ -153,6 +165,30 @@ const ThemeEditor: React.FC = () => { onChange={updateColors('danger')} resetKey={resetKey} /> + + + + + + + + @@ -209,4 +245,27 @@ const PaletteListItem: React.FC = ({ label, palette, onChange, ); }; +interface IColorListItem { + label: React.ReactNode, + value: string, + onChange: (hex: string) => void, +} + +/** Single-color picker. */ +const ColorListItem: React.FC = ({ label, value, onChange }) => { + const handleChange: ColorChangeHandler = (color, _e) => { + onChange(color.hex); + }; + + return ( + + + + ); +}; + export default ThemeEditor; \ No newline at end of file