Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion app/src/lib/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";
import { extendTailwindMerge } from "tailwind-merge";

// tailwind-merge only knows Tailwind's stock scale, so the design system's
// fontSize tokens (text-button, text-body, …) fall through to the text-color
// group and cancel real color classes in the same cn() call — e.g. text-button
// silently dropped text-brand-fg from the primary Button (#62). Declaring them
// as font-size classes keeps size and color merging independently.
const twMerge = extendTailwindMerge({
extend: {
classGroups: {
"font-size": [
{
text: [
"display",
"h1",
"h2",
"body",
"body-semibold",
"body-16",
"body-12",
"button",
"label",
"caption",
],
},
],
},
},
});

export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
Expand Down
Loading