Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Theme button color fix #121

Merged
merged 2 commits into from
Feb 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions app/[locale]/components/header/DarkModeToggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ export interface DarkModeToggleProps {

const DarkModeToggle = ({ srText }: DarkModeToggleProps) => {
const { theme, setTheme } = useTheme();
const [mounted, setMounted] = React.useState(false);

React.useEffect(() => {
setMounted(true);
}, []);

if (!mounted) {
return null;
}

const toggleTheme = () => {
if (theme === "light") {
Expand Down
6 changes: 5 additions & 1 deletion app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ export default async function RootLayout({
if (!availableLanguages.includes(locale as any)) notFound();

return (
<html lang={locale}>
<html
lang={locale}
suppressHydrationWarning
>
<head>
<PlausibleProvider
domain="rockylinux.org"
Expand All @@ -71,6 +74,7 @@ export default async function RootLayout({
/>
</head>
<body
suppressHydrationWarning
className={cn(
"min-h-screen bg-background font-sans antialiased mx-auto px-4 xl:px-0",
fontSans.variable,
Expand Down