Skip to content

Commit 5a55ba1

Browse files
fix: conditionally render WeatherWidget based on environment variable
1 parent a0b4b31 commit 5a55ba1

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,5 @@ yarn-error.log*
4141
next-env.d.ts
4242

4343
tests/reports
44-
playwright-report
44+
playwright-report
45+
.env*.local

src/app/layout.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import Header from "./header"; // Import the Header component
66
import Footer from "./footer"; // Import the Footer component
77
import { useState } from "react";
88

9+
const showWeatherWidget = process.env.NEXT_PUBLIC_SHOW_WEATHER_WIDGET;
10+
911
export default function RootLayout({
1012
children,
1113
}: {
@@ -29,7 +31,7 @@ export default function RootLayout({
2931
<Header toggleDarkMode={toggleDarkMode} darkMode={darkMode} />
3032
<main>
3133
{children}
32-
<WeatherWidget />
34+
{showWeatherWidget && <WeatherWidget />}
3335
<TaskList />
3436
</main>
3537
<Footer />

0 commit comments

Comments
 (0)