Free open-source image editor for the browser
import { IconButton } from "@roprgm/ui/icon-button";
import { useStore } from "zustand";
import { useDocument } from "@/components/editor/session";
export function ClippingControls() {
const { preview } = useDocument();
const shadows = useStore(preview, (state) => state.shadows);
const highlights = useStore(preview, (state) => state.highlights);
const state = { shadows, highlights };
return (
<div className="pointer-events-none absolute inset-x-1 top-1 z-10 flex justify-between">
{(["shadows", "highlights"] as const).map((range) => (
<IconButton
key={range}
label={`Show clipped ${range}`}
aria-pressed={state[range]}
className="pointer-events-auto flex size-6 items-center justify-center rounded-sm bg-level-2/80 p-0 opacity-0 transition-opacity group-hover:opacity-100 focus-visible:opacity-100 aria-pressed:bg-pressed aria-pressed:text-foreground aria-pressed:opacity-100 pointer-coarse:opacity-100"
onClick={() => preview.setState({ [range]: !state[range] })}
>
<svg
aria-hidden="true"
viewBox="0 0 12 12"
className="size-3"
fill="currentColor"
>
<path d="M6 2 11 10H1Z" />
</svg>
</IconButton>
))}
</div>
);
}