summaryrefslogtreecommitdiff
path: root/lib/utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'lib/utils.ts')
-rw-r--r--lib/utils.ts21
1 files changed, 21 insertions, 0 deletions
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 + ".";
+}