Skip to content

Commit 774f6ce

Browse files
committed
refactor(web): voice note bubbles use a ContextChip shape variant
1 parent e259a7b commit 774f6ce

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

‎apps/web/src/components/ContextChip.tsx‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ const contextChipVariants = cva(
3535
"doc-slides": "[--context-chip-accent:var(--context-chip-doc-slides)]",
3636
"doc-epub": "[--context-chip-accent:var(--context-chip-doc-epub)]",
3737
},
38+
shape: {
39+
inline: "",
40+
bubble: "w-64 gap-2 rounded-2xl bg-message px-3 py-2 text-sm text-message-foreground",
41+
},
3842
state: {
3943
unresolved: "data-[state=unresolved]:[--context-chip-accent:currentColor]",
4044
invalid:
@@ -49,11 +53,12 @@ type ContextChipKind = NonNullable<VariantProps<typeof contextChipVariants>["kin
4953
interface ContextChipProps extends useRender.ComponentProps<"span"> {
5054
kind?: ContextChipKind;
5155
state?: "unresolved" | "invalid";
56+
shape?: "inline" | "bubble";
5257
}
5358

54-
function ContextChip({ className, kind, state, render, ...props }: ContextChipProps) {
59+
function ContextChip({ className, kind, state, shape, render, ...props }: ContextChipProps) {
5560
const defaultProps = {
56-
className: cn(contextChipVariants({ kind, state }), className),
61+
className: cn(contextChipVariants({ kind, state, shape }), className),
5762
"data-slot": "context-chip",
5863
"data-state": state,
5964
};

‎apps/web/src/components/files/AudioPreview.tsx‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { LoaderCircleIcon, PauseIcon, PlayIcon, TriangleAlertIcon } from "lucide
22
import { createContext, useContext, useRef, useState } from "react";
33

44
import { useStableCallback } from "~/hooks/useStableCallback";
5-
import { cn } from "~/lib/utils";
65
import { ContextChip, ContextChipAction, ContextChipLabel } from "../ContextChip";
76
import { middleTruncateAttachmentName } from "../composerInlineChip";
87

@@ -113,11 +112,8 @@ function AudioChip(props: AudioPreviewProps) {
113112
<ContextChip
114113
kind="file"
115114
{...(props.failed ? { state: "invalid" as const } : {})}
116-
className={cn(
117-
"relative isolate overflow-hidden",
118-
props.variant === "bubble" &&
119-
"w-64 gap-2 rounded-2xl bg-message px-3 py-2 text-sm text-message-foreground",
120-
)}
115+
{...(props.variant === "bubble" ? { shape: "bubble" as const } : {})}
116+
className="relative isolate overflow-hidden"
121117
title={props.failed ? "Audio unavailable. Open the file or retry playback." : props.name}
122118
>
123119
<span

0 commit comments

Comments
 (0)