diff --git a/src/components/ImageOverlay.stories.tsx b/src/components/ImageOverlay.stories.tsx new file mode 100644 index 000000000..0d4385f97 --- /dev/null +++ b/src/components/ImageOverlay.stories.tsx @@ -0,0 +1,49 @@ +import { useState } from "react"; +import type { Meta, StoryObj } from "@storybook/nextjs"; +import ImageOverlayPanel from "./ImageOverlay"; +import type { OverlayPosition } from "../lib/types"; + +function ImageOverlayStory({ withImage = true }: { withImage?: boolean }) { + const [file, setFile] = useState(() => + withImage + ? new File( + [ + Uint8Array.from( + atob( + "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQIHWP4z8DwHwAFgAI/ScLbtAAAAABJRU5ErkJggg==" + ), + (char) => char.charCodeAt(0) + ), + ], + "overlay.png", + { type: "image/png" } + ) + : null + ); + const [position, setPosition] = useState("bottom-right"); + const [size, setSize] = useState(150); + const [opacity, setOpacity] = useState(75); + return ( + + ); +} + +const meta = { + title: "Editor/Controls/ImageOverlay", + component: ImageOverlayStory, + parameters: { layout: "padded" }, +} satisfies Meta; + +export default meta; +type Story = StoryObj; +export const SelectPresets: Story = {}; +export const NoImage: Story = { args: { withImage: false } }; diff --git a/src/components/ImageOverlay.tsx b/src/components/ImageOverlay.tsx index c6630c331..f93de5dbb 100644 --- a/src/components/ImageOverlay.tsx +++ b/src/components/ImageOverlay.tsx @@ -145,6 +145,8 @@ export default function ImageOverlayPanel({ key={value} type="button" onClick={() => setOverlayPosition(value)} + aria-label={`Position overlay at ${value.replace("-", " ")}`} + aria-pressed={overlayPosition === value} className={`rounded border py-0.5 text-center text-[10px] transition flex items-center justify-center gap-0.5 ${ overlayPosition === value ? "border-[var(--accent)] text-[var(--text)] bg-[var(--accent-muted)]" @@ -167,6 +169,7 @@ export default function ImageOverlayPanel({