diff --git a/src/components/ColorInput/ColorInput.css b/src/components/ColorInput/ColorInput.css index 97b1b08..dd51027 100644 --- a/src/components/ColorInput/ColorInput.css +++ b/src/components/ColorInput/ColorInput.css @@ -6,16 +6,16 @@ flex: 1; border: none; outline: none; + appearance: none; -webkit-appearance: none; } .color-picker span { + display: grid; + place-items: center; position: absolute; margin: 0; - top: 50%; - left: 50%; - -ms-transform: translate(-50%, -50%); - transform: translate(-50%, -50%); + inset: 0; -moz-user-select: none; -webkit-user-select: none; user-select: none; @@ -46,4 +46,4 @@ input.color-input::-webkit-color-swatch { input.color-input:focus { outline: none; border: 2px solid white; -} \ No newline at end of file +} diff --git a/src/components/ColorInput/ColorInput.tsx b/src/components/ColorInput/ColorInput.tsx index 4f9201c..2fc03e9 100644 --- a/src/components/ColorInput/ColorInput.tsx +++ b/src/components/ColorInput/ColorInput.tsx @@ -1,5 +1,6 @@ import { useCallback } from "react"; import { useRecoilState, useRecoilValue } from "recoil"; +import { EyedropperSample } from "@phosphor-icons/react"; import { useThrottled } from "@/hooks"; import { iconColorAtom, isDarkThemeSelector } from "@/state"; @@ -22,12 +23,21 @@ const ColorInput = (_: ColorInputProps) => { [setColor] ); + const handleSetInheritedColor = (e: React.MouseEvent) => { + e.preventDefault(); + setColor("currentColor"); + }; + const throttledColorChange = useThrottled(handleColorChange, 100, [ handleColorChange, ]); return ( -