The VS Code of video editing, built for agents.
TypeScript
Add RemoveButton component for consistent removal functionality
konstantin-paulusad22093920fc
diff --git a/apps/web/src/components/dashboard/home-view.tsx b/apps/web/src/components/dashboard/home-view.tsxindex aac90ccc..8c5de45e 100644--- a/apps/web/src/components/dashboard/home-view.tsx+++ b/apps/web/src/components/dashboard/home-view.tsx@@ -26,6 +26,7 @@ import {DropdownMenuTrigger,} from "@/components/ui/dropdown-menu";import { Icon } from "@/components/ui/icon";+import { RemoveButton } from "@/components/ui/remove-button";import { projectRoute } from "@/hooks/use-project-route";import { store } from "@/init";import {@@ -413,7 +414,7 @@ export function DashboardHomeView() {{/* The remove buttons overhang the tiles' corners, and ascrolling row clips at its edge — so the row pads for themand pulls itself back up by the same amount. */}- <div class="-mt-2 flex w-full items-start gap-2 overflow-x-auto pt-2 pr-2">+ <div class="-mt-2.5 flex w-full items-start gap-2 overflow-x-auto pt-2.5 pr-2.5"><For each={attachments()}>{(entry) => (<AttachmentTile@@ -690,7 +691,7 @@ type AttachmentTileProps = {function AttachmentTile(props: AttachmentTileProps) {return (<div class="group relative size-10 shrink-0" title={props.attachment.name}>- <div class="grid size-full place-items-center overflow-hidden rounded-md bg-input text-muted-foreground">+ <div class="grid size-full place-items-center overflow-hidden rounded-lg bg-input text-muted-foreground"><Showwhen={props.attachment.kind === "folder"}fallback={@@ -702,16 +703,11 @@ function AttachmentTile(props: AttachmentTileProps) {<Icon name="navigation.folder" class="size-6" /></Show></div>- <button- type="button"- aria-label={`Remove ${props.attachment.name}`}- class="absolute -right-2 -top-2 z-10 grid size-5 place-items-center opacity-0 transition-opacity group-hover:opacity-100 focus-visible:opacity-100"+ <RemoveButton+ label={`Remove ${props.attachment.name}`}+ class="absolute -right-2.5 -top-2.5 z-10 opacity-0 transition-opacity group-hover:opacity-100 focus-visible:opacity-100"onClick={props.onRemove}- >- <div class="flex size-4 items-center justify-center overflow-hidden rounded-full border border-border bg-background">- <Icon name="close-remove-small" class="size-5 min-h-5 min-w-5" />- </div>- </button>+ /></div>);}diff --git a/apps/web/src/components/genai/prompt-input.tsx b/apps/web/src/components/genai/prompt-input.tsxindex d4440c32..39b75f69 100644--- a/apps/web/src/components/genai/prompt-input.tsx+++ b/apps/web/src/components/genai/prompt-input.tsx@@ -11,6 +11,7 @@ import {DropdownMenuTrigger,} from "@/components/ui/dropdown-menu";import { Icon } from "@/components/ui/icon";+import { RemoveButton } from "@/components/ui/remove-button";import { SearchInput } from "@/components/ui/search-input";import { Button } from "@/components/ui/button";import { Popover, PopoverContent, PopoverPortal, PopoverTrigger } from "@/components/ui/popover";@@ -1070,15 +1071,11 @@ function PromptInputReferenceImageButton(props: PromptInputReferenceImageButtonP<AssetThumbnail asset={props.asset} cache={props.cache} class="size-full" size={props.size} /></div><Show when={props.onRemove}>- <button- type="button"- class="absolute right-0 top-0 z-10 grid size-8 place-items-center opacity-0 transition-opacity group-hover:opacity-100"+ <RemoveButton+ label="Remove reference"+ class="absolute right-1.5 top-1.5 z-10 opacity-0 transition-opacity group-hover:opacity-100 focus-visible:opacity-100"onClick={props.onRemove}- >- <div class="size-5 flex items-center justify-center overflow-hidden rounded-full border border-border bg-background">- <Icon name="close-remove-small" class="size-6 min-w-6 min-h-6" />- </div>- </button>+ /></Show></div>);diff --git a/apps/web/src/components/ui/remove-button.tsx b/apps/web/src/components/ui/remove-button.tsxnew file mode 100644index 00000000..1e039d6f--- /dev/null+++ b/apps/web/src/components/ui/remove-button.tsx@@ -0,0 +1,42 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import { Icon } from "@/components/ui/icon";+import { cx } from "@/lib/cva";+import type { JSX } from "solid-js";++type RemoveButtonProps = {+ /** What is removed, for the accessible name. */+ label: string;+ class?: string;+ onClick: JSX.EventHandlerUnion<HTMLButtonElement, MouseEvent>;+};++/**+ * The UI library's "Remove Button": a 20px disc with the small close mark,+ * on the canvas colour with a hairline border, that fills and firms up its+ * border on hover. Where it sits, and whether it waits for a hover on its+ * parent to show, is the caller's — pass that through `class`.+ */+export function RemoveButton(props: RemoveButtonProps) {+ return (+ <button+ type="button"+ aria-label={props.label}+ class={cx(+ "relative size-5 shrink-0 overflow-clip rounded-full border border-border bg-canvas text-foreground transition-colors hover:border-border-input hover:bg-muted focus-ring",+ props.class,+ )}+ onClick={props.onClick}+ >+ {/* The mark is drawn on a 24px box, larger than the disc, so it is+ pinned to the centre rather than laid out — an overflowing flex or+ grid child falls back to the start edge instead of centring. */}+ <Icon+ name="close-remove-small"+ class="absolute left-1/2 top-1/2 size-6 -translate-x-1/2 -translate-y-1/2"+ />+ </button>+ );+}