Skip to content

Commit

Permalink
Merge pull request #3 from No0ne003/refactore
Browse files Browse the repository at this point in the history
refactore: remove WhatTheme hook
  • Loading branch information
No0ne003 authored May 31, 2024
2 parents 793570c + 1afe0fd commit bcce2c2
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions src/lib/utils.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,6 @@
import { useTheme } from "@/components/theme-provider";
import { clsx } from "clsx";
import { useEffect } from "react";
import { twMerge } from "tailwind-merge";

export function cn(...inputs) {
return twMerge(clsx(inputs));
}

// know what theme is set and set theme
export default function useWhatTheme() {
const { theme, setTheme } = useTheme();

useEffect(() => {
if (theme === "system") {
setTheme(
window.matchMedia("(prefers-color-scheme: dark)")?.matches
? "dark"
: "light",
);
}
});

return { theme };
}

0 comments on commit bcce2c2

Please sign in to comment.