diff --git a/src/components/ActiveColorPicker.tsx b/src/components/ActiveColorPicker.tsx index 221a1de..8b2d3a1 100644 --- a/src/components/ActiveColorPicker.tsx +++ b/src/components/ActiveColorPicker.tsx @@ -19,14 +19,11 @@ const ActiveColorPicker: React.FC = () => { } return ( -
+
handleColorChange(activeColor, newColor)} /> -

- {activeColor} -

) } diff --git a/src/components/ColorPicker.tsx b/src/components/ColorPicker.tsx index 43427f8..db4f65a 100644 --- a/src/components/ColorPicker.tsx +++ b/src/components/ColorPicker.tsx @@ -1,17 +1,40 @@ -import React from "react"; -import { HexColorPicker } from "react-colorful"; +import React from 'react' +import { HexAlphaColorPicker, HexColorInput } from 'react-colorful' +import { useTheme } from '../contexts/ThemeContext' interface ColorPickerProps { - color: string; - onChange: (color: string) => void; + color: string + onChange: (color: string) => void } const ColorPicker: React.FC = ({ color, onChange }) => { + const { activeColor } = useTheme() + const handleInputChange = (value: string) => { + if (value.startsWith('#') && value.length > 6) { + onChange(value) + } + } + return ( -
- +
+ + +
+

+ {activeColor} +

+
+ +
+
- ); -}; + ) +} -export default ColorPicker; +export default ColorPicker