ar-test/app/lib/utils.ts

18 lines
644 B
TypeScript

import { clsx, type ClassValue } from 'clsx';
import { extendTailwindMerge } from 'tailwind-merge';
// Teach tailwind-merge the custom @theme sizes and radii in app.css, so e.g. `text-display`
// is treated as a font size (not dropped as a colour) and radius overrides replace each other
const twMerge = extendTailwindMerge({
extend: {
theme: {
text: ['3xs', '2xs', 'md', 'display'],
radius: ['chip', 'option', 'item', 'control', 'group', 'field', 'card-sm', 'card', 'panel', 'phone', 'phone-screen'],
},
},
});
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}