An open source design system that's fully customizable and agent ready
TypeScript
fix(docsite): inherit site theme mode in component detail preview (#2390)
Cindy Zhang89b811ed09ed
diff --git a/apps/docsite/src/components/component-detail/ShowcasePreview.tsx b/apps/docsite/src/components/component-detail/ShowcasePreview.tsxindex 40a156a9f1..027298296a 100644--- a/apps/docsite/src/components/component-detail/ShowcasePreview.tsx+++ b/apps/docsite/src/components/component-detail/ShowcasePreview.tsx@@ -10,12 +10,14 @@ import {XDSTheme} from '@xds/core/theme';import {useMediaQuery} from '@xds/core/hooks';import {neutralTheme} from '@xds/theme-neutral/built';import {showcaseRegistry} from '../../generated/showcaseRegistry';+import {useThemeMode} from '../../app/providers';interface ShowcasePreviewProps {name: string;}export function ShowcasePreview({name}: ShowcasePreviewProps) {+ const {mode} = useThemeMode();const [Component, setComponent] = useState<ComponentType | null>(null);const [error, setError] = useState(false);const isSmall = useMediaQuery('(max-width: 768px)');@@ -55,7 +57,7 @@ export function ShowcasePreview({name}: ShowcasePreviewProps) {if (isSmall) {return (- <XDSTheme theme={neutralTheme}>+ <XDSTheme theme={neutralTheme} mode={mode}><divstyle={{width: '100%',@@ -74,7 +76,7 @@ export function ShowcasePreview({name}: ShowcasePreviewProps) {}return (- <XDSTheme theme={neutralTheme}>+ <XDSTheme theme={neutralTheme} mode={mode}><divstyle={{width: '100%',