import React from "react" import { Block } from "baseui/block" import Scrollable from "~/components/Scrollable" import { HexColorPicker } from "react-colorful" import { Delete } from "baseui/icon" import { throttle } from "lodash" import { useActiveObject, useEditor } from "@layerhub-io/react" const PRESET_COLORS = [ "#f44336", "#ff9800", "#ffee58", "#66bb6a", "#26a69a", "#03a9f4", "#3f51b5", "#673ab7", "#9c27b0", "#ec407a", "#8d6e63", "#d9d9d9", ] export default function () { const [color, setColor] = React.useState("#b32aa9") const activeObject = useActiveObject() const editor = useEditor() const updateObjectFill = throttle((color: string) => { if (activeObject) { editor.objects.update({ fill: color }) } setColor(color) }, 100) return ( Path Fill Preset colors {PRESET_COLORS.map((color, index) => ( updateObjectFill(color)} backgroundColor={color} height={"38px"} key={index} > ))} ) }