"use client"; import { hsvaToHslString } from "@noya-app/noya-color"; import { clamp, round } from "@noya-app/noya-utils"; import React, { memo } from "react"; import { useColorPicker } from "../contexts/ColorPickerContext"; import { Interaction, Interactive } from "./Interactive"; import Pointer from "./Pointer"; const Container: React.FC<{ children: React.ReactNode }> = ({ children }) => (
{children}
); export default memo(function HueBase() { const [{ h: hue }, onChange] = useColorPicker(); const color = hsvaToHslString({ h: hue, s: 100, v: 100, a: 1 }); const handleMove = (interaction: Interaction) => { onChange({ h: 360 * interaction.left }); }; const handleKey = (offset?: Interaction) => { // Hue measured in degrees of the color circle ranging from 0 to 360 if (!offset) return; onChange({ h: clamp(hue + offset.left * 360, 0, 360), }); }; return ( ); });