feat(module)!: use tailwind-merge for class merging (#509)

This commit is contained in:
Benjamin Canac
2023-08-12 17:17:00 +02:00
parent 6d7973f6e1
commit 8880bdc456
47 changed files with 685 additions and 376 deletions

View File

@@ -1,6 +1,13 @@
export function classNames (...classes: any[string]) {
return classes.filter(Boolean).join(' ')
}
import { createDefu } from 'defu'
import { twMerge } from 'tailwind-merge'
export const defuTwMerge = createDefu((obj, key, value) => {
if (typeof obj[key] === 'string' && typeof value === 'string' && obj[key] && value) {
// @ts-ignore
obj[key] = twMerge(obj[key], value)
return true
}
})
export const hexToRgb = (hex: string) => {
// Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")