22 lines
541 B
TypeScript
22 lines
541 B
TypeScript
import { type ClassValue, clsx } from "clsx";
|
|
import { twMerge } from "tailwind-merge";
|
|
|
|
export function cn(...inputs: ClassValue[]) {
|
|
return twMerge(clsx(inputs));
|
|
}
|
|
|
|
export function capitalizeFirstLetter(str: string): string {
|
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
}
|
|
|
|
export function titleCase(str: string) {
|
|
return str.replace(
|
|
/\w\S*/g,
|
|
(text) => text.charAt(0).toUpperCase() + text.substring(1).toLowerCase()
|
|
);
|
|
}
|
|
|
|
// Force a reload of the page
|
|
export function forceReload() {
|
|
window.location.reload();
|
|
}
|