mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-12 10:36:44 +00:00
fix next hydration, theme, server package, turbo deps
This commit is contained in:
@@ -1,12 +1,25 @@
|
||||
"use client";
|
||||
|
||||
import { Switch } from "@headlessui/react";
|
||||
import { MoonIcon, SunIcon } from "@heroicons/react/24/outline";
|
||||
import { useTheme } from "next-themes";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
export default function Theme() {
|
||||
const { resolvedTheme, setTheme } = useTheme();
|
||||
const [mounted, setMounted] = useState<boolean>(false);
|
||||
|
||||
const isDark = resolvedTheme === "dark";
|
||||
|
||||
// useEffect only runs on the client, so now we can safely show the UI
|
||||
useEffect(() => {
|
||||
setMounted(true);
|
||||
}, []);
|
||||
|
||||
if (!mounted) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<Switch
|
||||
checked={isDark}
|
||||
@@ -18,7 +31,6 @@ export default function Theme() {
|
||||
}
|
||||
relative inline-flex h-4 w-9 items-center rounded-full`}
|
||||
>
|
||||
<span className="sr-only">Dark mode enabled</span>
|
||||
<div
|
||||
aria-hidden="true"
|
||||
className={`${
|
||||
|
||||
Reference in New Issue
Block a user