From b97f3b42e1bad5753728315b5c7ebdacf6f81172 Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Mon, 6 Jan 2025 23:48:56 -0800 Subject: initial commit --- lib/utils.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 lib/utils.ts (limited to 'lib/utils.ts') diff --git a/lib/utils.ts b/lib/utils.ts new file mode 100644 index 0000000..e70557a --- /dev/null +++ b/lib/utils.ts @@ -0,0 +1,21 @@ +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 + "."; +} -- cgit v1.2.3-70-g09d2