Skip to content

Commit b03dac6

Browse files
refactor(tailwind.config): update dark mode strategy to use the class selector
1 parent 636de38 commit b03dac6

File tree

5 files changed

+6
-10
lines changed

5 files changed

+6
-10
lines changed

src/components/ThemeProvider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const ThemeProvider = ({ children }: Pick<ThemeProviderProps, "children">) => {
1717

1818
return (
1919
<NextThemesProvider
20-
attribute="data-theme"
20+
attribute="class"
2121
defaultTheme="light"
2222
disableTransitionOnChange
2323
storageKey={COLOR_MODE_STORAGE_KEY}

src/styles/docsearch.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
--docsearch-hit-height: fit-content;
4040
}
4141

42-
[data-theme="dark"] {
42+
.dark {
4343
--docsearch-modal-background: theme(backgroundColor.background.DEFAULT);
4444
--docsearch-highlight-color: theme(colors.primary.hover);
4545
}

src/styles/global.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
);
5151
}
5252

53-
[data-theme="dark"] {
53+
.dark {
5454
/* Misc semantics: dark mode */
5555
--tooltip-shadow: rgba(255, 255, 255, 0.24);
5656
--switch-background: rgba(255, 255, 255, 0.24);

src/styles/semantic-tokens.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
}
130130

131131
/* Dark mode token declarations */
132-
[data-theme="dark"] {
132+
.dark {
133133
--body: var(--gray-100);
134134
--body-medium: var(--gray-400);
135135
--body-light: var(--gray-600);

tailwind.config.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,8 @@ import { screens } from "./src/lib/utils/screen"
55

66
const config = {
77
// TODO: Move to "class" strategy after removing Chakra
8-
darkMode: ["selector", '[data-theme="dark"]'],
9-
content: [
10-
"./src/**/*.{ts,tsx}",
11-
// TODO: remove after migration
12-
"./tailwind/**/*.tsx",
13-
],
8+
darkMode: ["selector"],
9+
content: ["./src/**/*.{ts,tsx}"],
1410
prefix: "",
1511
theme: {
1612
extend: {

0 commit comments

Comments
 (0)