Skip to content

Commit f013ab1

Browse files
committed
Support color schemes and dark mode through url params
1 parent 19ff7a9 commit f013ab1

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

src/App.tsx

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import EnumerationDemo, { EnumerationType } from './components/EnumerationDemo';
1+
import EnumerationDemo, {
2+
EnumerationType,
3+
ThemeColors,
4+
} from './components/EnumerationDemo';
25

36
function App() {
47
const queryParams = new URLSearchParams(window.location.search);
@@ -12,9 +15,22 @@ function App() {
1215
demoType = queryParams.get('demoType') as EnumerationType;
1316
}
1417

18+
const customColors = {} as ThemeColors;
19+
customColors.background = queryParams.get('background') || undefined;
20+
customColors.primary = queryParams.get('primary') || undefined;
21+
customColors.secondary = queryParams.get('secondary') || undefined;
22+
customColors.accent = queryParams.get('accent') || undefined;
23+
customColors.gridLines = queryParams.get('gridLines') || undefined;
24+
25+
const isDarkMode = queryParams.get('isDarkMode') === 'true';
26+
1527
return (
1628
<div className='min-h-screen flex items-center justify-center p-4'>
17-
<EnumerationDemo demoType={demoType} />
29+
<EnumerationDemo
30+
demoType={demoType}
31+
customColors={customColors}
32+
isDarkMode={isDarkMode}
33+
/>
1834
</div>
1935
);
2036
}

0 commit comments

Comments
 (0)