Skip to content

Open source CapCut alternative.

TypeScript

refactor(site): share one card icon-button style across panels

David Lecd5d6a6527cb
diff --git a/site/src/cut/components/AudioPanel.tsx b/site/src/cut/components/AudioPanel.tsx
index db926498..2a3576c5 100644
--- a/site/src/cut/components/AudioPanel.tsx
+++ b/site/src/cut/components/AudioPanel.tsx
@@ -43,6 +43,7 @@ import { DUCK_DEFAULT } from "@/cut/lib/voiceover";
import { useSpeakerVoice, useSpeechLanguage, VoicePicker } from "@/cut/components/VoicePicker";
import { GeneratedAssetMenu } from "@/cut/components/GeneratedAssetMenu";
import { cn } from "@/lib/utils";
+import { cardIconButton } from "@/cut/components/iconButton";
/** Starting points for the direction prompt — picking one fills the input so
* it can be tweaked before generating. */
@@ -425,7 +426,7 @@ function AudioRow({
type="button"
title="Add at the playhead"
aria-label="Add at the playhead"
- className="grid size-6 shrink-0 place-items-center rounded-full text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"
+ className={cardIconButton}
onClick={onAdd}
>
<Plus className="size-3.5" />
@@ -471,7 +472,7 @@ function ProjectAudio({
<GeneratedAssetMenu
asset={a}
projectId={projectId}
- triggerClassName="grid size-6 shrink-0 place-items-center rounded-full text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"
+ triggerClassName={cardIconButton}
after={
<DropdownMenuItem
variant="destructive"
diff --git a/site/src/cut/components/SidePanel.tsx b/site/src/cut/components/SidePanel.tsx
index 6e75a57a..14991308 100644
--- a/site/src/cut/components/SidePanel.tsx
+++ b/site/src/cut/components/SidePanel.tsx
@@ -39,6 +39,7 @@ import { formatTime } from "@/cut/lib/time";
import { useLocalPref } from "@/cut/lib/uiState";
import type { MediaAsset } from "@/cut/lib/types";
import { cn } from "@/lib/utils";
+import { cardIconButton } from "@/cut/components/iconButton";
import { useRevealEffect, useRevealFlash } from "@/cut/lib/refReveal";
import { CopyNameLabel } from "./AssetRefs";
import { AudioPanel } from "./AudioPanel";
@@ -624,7 +625,7 @@ function LibraryPanel({ projectId }: { projectId: string }) {
</button>
<button
title="Delete template"
- className="grid size-6 shrink-0 place-items-center rounded-full text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100 hover:text-foreground"
+ className={cn(cardIconButton, "opacity-0 group-hover:opacity-100")}
onClick={() => void removeTemplate(t.id)}
>
<Trash2 className="size-3.5" />
diff --git a/site/src/cut/components/iconButton.ts b/site/src/cut/components/iconButton.ts
new file mode 100644
index 00000000..6d39d7b3
--- /dev/null
+++ b/site/src/cut/components/iconButton.ts
@@ -0,0 +1,6 @@
+/** Small trailing icon control on a light card row or list item (add, menu,
+ * copy, dismiss): a filled pill, matching the row's play button, so it reads
+ * clearly against the card the moment a hover reveal shows it. Media tiles
+ * use the dark `bg-black/45 text-white` scrim pill instead. */
+export const cardIconButton =
+ "grid size-6 shrink-0 place-items-center rounded-full bg-muted text-foreground transition-all hover:bg-muted-foreground/20";