refactor: with styled-components

This commit is contained in:
Daniel Soares
2021-12-18 00:50:54 -03:00
parent 5138b4dfc2
commit 47d03b6d73
42 changed files with 845 additions and 934 deletions

View File

@@ -0,0 +1,35 @@
import { BlockPicker } from 'react-color'
import { useData } from '../../../hooks/useData'
import { colors } from '../../../styles/colors'
type ColorPickerProps = {
prop: 'texts' | 'socialLinks' | 'background' | 'buttonLinks'
}
export function ColorPicker({ prop }: ColorPickerProps) {
const { data, setData } = useData()
const handleChange = (color: string) => {
setData({
...data,
settings: {
...data.settings,
colors: {
...data.settings.colors,
[prop]: color
}
}
})
}
return (
<BlockPicker
color={data.settings.colors[prop]}
colors={colors}
triangle="hide"
width="100%"
onChangeComplete={color => handleChange(color.hex)}
/>
)
}