aboutsummaryrefslogtreecommitdiff
path: root/apps/web/lib/get-theme-button.tsx
diff options
context:
space:
mode:
authorKinfe Michael Tariku <[email protected]>2024-06-25 19:56:54 +0300
committerGitHub <[email protected]>2024-06-25 19:56:54 +0300
commitf46e42c2dfd1b223d4ad701a86d05fc0bb380e45 (patch)
treef17fdfadf3bec08eee7f02da33af952796657254 /apps/web/lib/get-theme-button.tsx
parentfix: import using absolute path (diff)
parentdev and prod databases (diff)
downloadarchived-supermemory-f46e42c2dfd1b223d4ad701a86d05fc0bb380e45.tar.xz
archived-supermemory-f46e42c2dfd1b223d4ad701a86d05fc0bb380e45.zip
Merge branch 'main' into feat/landing_revamp
Diffstat (limited to 'apps/web/lib/get-theme-button.tsx')
-rw-r--r--apps/web/lib/get-theme-button.tsx11
1 files changed, 11 insertions, 0 deletions
diff --git a/apps/web/lib/get-theme-button.tsx b/apps/web/lib/get-theme-button.tsx
new file mode 100644
index 00000000..020cc976
--- /dev/null
+++ b/apps/web/lib/get-theme-button.tsx
@@ -0,0 +1,11 @@
+// Theming that works perfectly with app router (no flicker, jumps etc!)
+
+import dynamic from "next/dynamic";
+
+// Don't SSR the toggle since the value on the server will be different than the client
+export const getThemeToggler = () =>
+ dynamic(() => import("@repo/ui/shadcn/theme-toggle"), {
+ ssr: false,
+ // Make sure to code a placeholder so the UI doesn't jump when the component loads
+ loading: () => <div className="w-6 h-6" />,
+ });