Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add optional dark theme to torchci app #6199

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

wdvr
Copy link
Contributor

@wdvr wdvr commented Jan 22, 2025

Add a dark theme option to the torchci Next.js app.

  • ThemeToggle Component: Create a new ThemeToggle component to handle theme switching with options for light, dark, and system themes. Use useState to manage the current theme and localStorage to save the user's preference. Apply the selected theme to the application.
  • Global Styles: Add CSS variables for light and dark themes in globals.css. Define styles for both themes, ensuring all backgrounds are dark with readable fonts for the dark theme.
  • App Component: Import and use the ThemeToggle component in _app.tsx. Wrap the application with a context provider to manage the theme state.
  • NavBar Component: Import and include the ThemeToggle component in the navigation bar.

For more details, open the Copilot Workspace session.

Add a dark theme option to the torchci Next.js app.

* **ThemeToggle Component**: Create a new `ThemeToggle` component to handle theme switching with options for light, dark, and system themes. Use `useState` to manage the current theme and `localStorage` to save the user's preference. Apply the selected theme to the application.
* **Global Styles**: Add CSS variables for light and dark themes in `globals.css`. Define styles for both themes, ensuring all backgrounds are dark with readable fonts for the dark theme.
* **App Component**: Import and use the `ThemeToggle` component in `_app.tsx`. Wrap the application with a context provider to manage the theme state.
* **NavBar Component**: Import and include the `ThemeToggle` component in the navigation bar.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/pytorch/test-infra?shareId=XXXX-XXXX-XXXX-XXXX).
Copy link

vercel bot commented Jan 22, 2025

@wdvr is attempting to deploy a commit to the Meta Open Source Team on Vercel.

A member of the Team first needs to authorize it.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jan 22, 2025
Copy link

vercel bot commented Jan 22, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
torchci ❌ Failed (Inspect) Jan 22, 2025 0:33am

…lient side

* Check if `window` is defined before accessing `localStorage` and `document`
* Move `localStorage.setItem` inside the `if` block to ensure it runs only on the client side
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants