Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
fix: add useEffect cleanup function
  • Loading branch information
jaaydenh committed Nov 5, 2024
commit 25cbb8730c6d8f6bd007b6a1b6d42cce8cf99b62
7 changes: 6 additions & 1 deletion site/src/contexts/ThemeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,16 @@ export const ThemeProvider: FC<PropsWithChildren> = ({ children }) => {

useEffect(() => {
const root = document.documentElement;
root.classList.remove("light", "dark");

if (themePreference === "auto") {
root.classList.add(preferredColorScheme);
} else {
root.classList.add(themePreference);
}

return () => {
root.classList.remove("light", "dark");
};
}, [themePreference, preferredColorScheme]);

const theme =
Expand All @@ -79,6 +83,7 @@ export const ThemeProvider: FC<PropsWithChildren> = ({ children }) => {
);
};

// This is being added to allow Tailwind and MUI to work together.
const cache = createCache({
key: "css",
prepend: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const EnterpriseVersion: FC = () => {
<p className="text-sm max-w-xl mt-2 text-content-secondary font-medium">
As an Enterprise license holder, you already benefit from Coder’s
features for secure, large-scale deployments. Upgrade to Coder
Premium for enhanced multi-tenant control and flexibility:
Premium for enhanced multi-tenant control and flexibility.
</p>
</div>
<Button asChild>
Expand Down