import React, { useEffect, useState } from 'react'; import { Button } from '../Button'; import { ThemeColors } from '../../styles/theme'; import { useColors } from '../../hooks/useColors'; import { EBrandingColorsOptions } from '../../types/theme'; import { ChromePicker } from 'react-color'; import { Popup } from '../Popup'; export const Editor = () => { const { colors, setColors } = useColors(); const [state, setState] = useState({ ...colors }); useEffect(() => { setState(colors); }, [colors]); const handleChange = (key, val) => { let newState = { ...state }; newState[key] = val; setState(newState); }; return (
{Object.keys(EBrandingColorsOptions).map((key, index) => { return (
} >
); })}
); }; const ColorPicker = ({ value, handleChange, index }) => { return (
{ handleChange(index, color.hex); }} />
); }; { /* {Object.keys(EBrandingColorsOptions).map((key, index) => { return ( ); })}
{key} { handleChange(key, e.target.value); }} /> } >
*/ }