22 lines
621 B
TypeScript
22 lines
621 B
TypeScript
|
import { clsx, type ClassValue } from "clsx";
|
||
|
import { twMerge } from "tailwind-merge";
|
||
|
|
||
|
export function cn(...inputs: ClassValue[]) {
|
||
|
return twMerge(clsx(inputs));
|
||
|
}
|
||
|
|
||
|
export function greet(name: string, time: Date) {
|
||
|
const messages: [number, number, string][] = [
|
||
|
[0, 4, "🌕 Good night"],
|
||
|
[5, 11, "🌤️ Good morning"], //Store messages in an array
|
||
|
[12, 17, "🌷͙ Good afternoon"],
|
||
|
[18, 23, "🌕 Good night"],
|
||
|
];
|
||
|
|
||
|
const message = messages.find(
|
||
|
([start, end]) => time.getHours() >= start && time.getHours() <= end
|
||
|
);
|
||
|
|
||
|
return (message ? message[2] : "Hello") + ", " + name + ".";
|
||
|
}
|