✨ feat (employee): add based component & conditional form input
This commit is contained in:
@@ -2,6 +2,25 @@ import type { ClassValue } from 'clsx'
|
||||
import { clsx } from 'clsx'
|
||||
import { twMerge } from 'tailwind-merge'
|
||||
|
||||
export interface SelectOptionType<T> {
|
||||
label: string
|
||||
value: T
|
||||
}
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs))
|
||||
}
|
||||
|
||||
export function mapToFlowbiteOptList(items: Record<string, string>): SelectOptionType<string>[] {
|
||||
if (!items) {
|
||||
return []
|
||||
}
|
||||
const result: SelectOptionType<string>[] = []
|
||||
Object.keys(items).forEach((item) => {
|
||||
result.push({
|
||||
label: items[item] as string,
|
||||
value: item,
|
||||
})
|
||||
})
|
||||
return result
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user