File size: 384 Bytes
41a71fd |
1 2 3 4 5 6 7 8 9 10 11 12 |
type Mods = Record<string, boolean | string | undefined>;
export function classNames(cls: string, mods: Mods = {}, additional: Array<string | undefined> = []): string {
return [
cls,
...additional.filter(Boolean),
...Object.entries(mods)
.filter(([_, value]) => Boolean(value))
.map(([className]) => className),
].join(' ');
}
|