mirror of
https://github.com/harivansh-afk/RAG-ui.git
synced 2026-04-15 18:01:29 +00:00
Initial commit
This commit is contained in:
commit
ae239a2849
42 changed files with 6674 additions and 0 deletions
26
src/utils/cn.ts
Normal file
26
src/utils/cn.ts
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
type ClassValue = string | number | boolean | undefined | null;
|
||||
type ClassArray = ClassValue[];
|
||||
type ClassObject = { [key: string]: any };
|
||||
type ClassInput = ClassValue | ClassArray | ClassObject;
|
||||
|
||||
export function cn(...inputs: ClassInput[]): string {
|
||||
const classes = [];
|
||||
|
||||
for (const input of inputs) {
|
||||
if (!input) continue;
|
||||
|
||||
if (typeof input === 'string') {
|
||||
classes.push(input);
|
||||
} else if (Array.isArray(input)) {
|
||||
classes.push(cn(...input));
|
||||
} else if (typeof input === 'object') {
|
||||
for (const key in input) {
|
||||
if (input[key]) {
|
||||
classes.push(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return classes.join(' ');
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue