Skip to content

Commit be18c37

Browse files
authored
Fix badges after redesign (#1710)
## Problem Badges got broken in the recent redesign: <img width="1230" height="828" alt="Screenshot 2026-04-17 at 15 09 58@2x" src="https://github.com/user-attachments/assets/19efef99-b2b9-4b59-b1b6-8a4c39050d9f" /> ## Changes Making them a bit nicer. Also following the existing conventions where badges have a border, whereas buttons do not: <img width="1230" height="840" alt="Screenshot 2026-04-17 at 15 09 27@2x" src="https://github.com/user-attachments/assets/a8aad411-ffe6-4bbb-a462-b25d6c1dffe8" />
1 parent 42b6031 commit be18c37

8 files changed

Lines changed: 49 additions & 65 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { cn } from "@posthog/quill";
2+
import { Badge as RadixBadge } from "@radix-ui/themes";
3+
import type { ComponentPropsWithoutRef } from "react";
4+
5+
type RadixBadgeProps = ComponentPropsWithoutRef<typeof RadixBadge>;
6+
7+
export type BadgeProps = RadixBadgeProps;
8+
9+
/**
10+
* Compact, uppercase badge built on Radix Badge.
11+
* Applies the house style (`size="1"`, `variant="surface"`, small text, uppercase)
12+
* so callers only need to pass `color` and children.
13+
*/
14+
export function Badge({
15+
size = "1",
16+
variant = "surface",
17+
className,
18+
...props
19+
}: BadgeProps) {
20+
return (
21+
<RadixBadge
22+
size={size}
23+
variant={variant}
24+
className={cn(
25+
"!py-[3px] !px-[5px] !text-[9px] !leading-tight uppercase",
26+
className,
27+
)}
28+
{...props}
29+
/>
30+
);
31+
}

apps/code/src/renderer/features/inbox/components/SignalSourceToggles.tsx

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Badge } from "@components/ui/Badge";
12
import {
23
ArrowSquareOutIcon,
34
BrainIcon,
@@ -10,7 +11,6 @@ import {
1011
VideoIcon,
1112
} from "@phosphor-icons/react";
1213
import {
13-
Badge,
1414
Box,
1515
Button,
1616
Flex,
@@ -221,14 +221,7 @@ export const EvaluationsSection = memo(function EvaluationsSection({
221221
PostHog LLM Analytics
222222
</Text>
223223
<Tooltip content="This is only visible to staff users of PostHog">
224-
<Badge
225-
color="blue"
226-
size="1"
227-
variant="surface"
228-
className="!py-0 !text-[9px] !leading-tight uppercase"
229-
>
230-
Internal
231-
</Badge>
224+
<Badge color="blue">Internal</Badge>
232225
</Tooltip>
233226
</Flex>
234227
<Text size="1" style={{ color: "var(--gray-11)" }}>
@@ -373,16 +366,7 @@ export function SignalSourceToggles({
373366
<SignalSourceToggleCard
374367
icon={<VideoIcon size={20} />}
375368
label="PostHog Session Replay"
376-
labelSuffix={
377-
<Badge
378-
color="orange"
379-
size="1"
380-
variant="surface"
381-
className="!py-0 !text-[9px] !leading-tight uppercase"
382-
>
383-
Alpha
384-
</Badge>
385-
}
369+
labelSuffix={<Badge color="orange">Alpha</Badge>}
386370
description="Analyze session recordings and event data for UX issues"
387371
checked={value.session_replay}
388372
onCheckedChange={toggleSessionReplay}

apps/code/src/renderer/features/inbox/components/detail/ReportDetailPane.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Badge } from "@components/ui/Badge";
12
import { useAuthStateValue } from "@features/auth/hooks/authQueries";
23
import {
34
useInboxReportArtefacts,
@@ -24,7 +25,6 @@ import {
2425
} from "@phosphor-icons/react";
2526
import {
2627
AlertDialog,
27-
Badge,
2828
Box,
2929
Button,
3030
Flex,
@@ -483,12 +483,7 @@ export function ReportDetailPane({ report, onClose }: ReportDetailPaneProps) {
483483
</Text>
484484
{isMe && (
485485
<Tooltip content="You are a suggested reviewer">
486-
<Badge
487-
color="amber"
488-
size="1"
489-
variant="surface"
490-
className="!py-1 !text-[8px] !leading-tight"
491-
>
486+
<Badge color="amber" className="!py-1 !text-[8px]">
492487
<EyeIcon
493488
size={8}
494489
weight="bold"

apps/code/src/renderer/features/inbox/components/utils/ReportCardContent.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
import { Badge } from "@components/ui/Badge";
12
import { SignalReportActionabilityBadge } from "@features/inbox/components/utils/SignalReportActionabilityBadge";
23
import { SignalReportPriorityBadge } from "@features/inbox/components/utils/SignalReportPriorityBadge";
34
import { SignalReportStatusBadge } from "@features/inbox/components/utils/SignalReportStatusBadge";
45
import { SignalReportSummaryMarkdown } from "@features/inbox/components/utils/SignalReportSummaryMarkdown";
56
import { EyeIcon, LightningIcon } from "@phosphor-icons/react";
6-
import { Badge, Flex, Text, Tooltip } from "@radix-ui/themes";
7+
import { Flex, Text, Tooltip } from "@radix-ui/themes";
78
import type { SignalReport } from "@shared/types";
89

910
interface ReportCardContentProps {
@@ -41,13 +42,7 @@ export function ReportCardContent({
4142
/>
4243
{report.is_suggested_reviewer && (
4344
<Tooltip content="You are a suggested reviewer">
44-
<Badge
45-
color="amber"
46-
size="1"
47-
variant="surface"
48-
className="!py-0 !text-[9px] !leading-tight uppercase"
49-
style={{ height: "var(--line-height-1)" }}
50-
>
45+
<Badge color="amber" style={{ height: "var(--line-height-1)" }}>
5146
<EyeIcon size={10} weight="bold" className="shrink-0" />
5247
</Badge>
5348
</Tooltip>

apps/code/src/renderer/features/inbox/components/utils/SignalReportActionabilityBadge.tsx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Badge } from "@radix-ui/themes";
1+
import { Badge } from "@components/ui/Badge";
22
import type { SignalReportActionability } from "@shared/types";
33
import type { ReactNode } from "react";
44

@@ -27,14 +27,5 @@ export function SignalReportActionabilityBadge({
2727
return null;
2828
}
2929

30-
return (
31-
<Badge
32-
color={s.color}
33-
size="1"
34-
variant="surface"
35-
className="!py-0 !text-[9px] !leading-tight uppercase"
36-
>
37-
{s.label}
38-
</Badge>
39-
);
30+
return <Badge color={s.color}>{s.label}</Badge>;
4031
}

apps/code/src/renderer/features/inbox/components/utils/SignalReportPriorityBadge.tsx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Badge } from "@radix-ui/themes";
1+
import { Badge } from "@components/ui/Badge";
22
import type { SignalReportPriority } from "@shared/types";
33
import type { ReactNode } from "react";
44

@@ -23,14 +23,5 @@ export function SignalReportPriorityBadge({
2323
return null;
2424
}
2525

26-
return (
27-
<Badge
28-
color={PRIORITY_COLOR[priority]}
29-
size="1"
30-
variant="surface"
31-
className="!py-0 !text-[9px] !leading-tight uppercase"
32-
>
33-
{priority}
34-
</Badge>
35-
);
26+
return <Badge color={PRIORITY_COLOR[priority]}>{priority}</Badge>;
3627
}

apps/code/src/renderer/features/inbox/components/utils/SignalReportStatusBadge.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
import { Badge } from "@components/ui/Badge";
12
import { inboxStatusLabel } from "@features/inbox/utils/inboxSort";
2-
import { Badge, Tooltip } from "@radix-ui/themes";
3+
import { Tooltip } from "@radix-ui/themes";
34
import type { SignalReportStatus } from "@shared/types";
45

56
const STATUS_TOOLTIPS: Record<string, string> = {
@@ -47,12 +48,7 @@ export function SignalReportStatusBadge({
4748

4849
return (
4950
<Tooltip content={tooltip}>
50-
<Badge
51-
color={color}
52-
size="1"
53-
variant="surface"
54-
className="!py-0 !text-[9px] !leading-tight cursor-help uppercase"
55-
>
51+
<Badge color={color} className="cursor-help">
5652
{label}
5753
</Badge>
5854
</Tooltip>

apps/code/src/renderer/features/sidebar/components/items/HomeItem.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
import { Badge } from "@components/ui/Badge";
12
import { Tooltip } from "@components/ui/Tooltip";
23
import { EnvelopeSimple, Plus } from "@phosphor-icons/react";
3-
import { Badge, type ButtonProps } from "@posthog/quill";
4+
import type { ButtonProps } from "@posthog/quill";
45
import {
56
formatHotkey,
67
SHORTCUTS,
@@ -73,7 +74,7 @@ export function InboxItem({ isActive, onClick, signalCount }: InboxItemProps) {
7374
}
7475
isActive={isActive}
7576
onClick={onClick}
76-
endContent={<Badge variant="warning">Beta</Badge>}
77+
endContent={<Badge color="amber">Beta</Badge>}
7778
/>
7879
</div>
7980
</Tooltip>

0 commit comments

Comments
 (0)