Skip to content

Commit

Permalink
docs: Apply root styles to overlay portal so they are displayed corre…
Browse files Browse the repository at this point in the history
…ctly. (#4197)

* docs: Apply root styles to overlay portal so they are displayed correctly.

* Create yellow-lies-bake.md
  • Loading branch information
sebald authored Oct 7, 2024
1 parent 3ac2ca8 commit f85bb04
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
7 changes: 7 additions & 0 deletions .changeset/yellow-lies-bake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@marigold/docs": patch
---

docs: Apply root styles to overlay portal so they are displayed correctly.

Overlay components (e.g. `<Dialog>` did not display correctly in the docs.
5 changes: 3 additions & 2 deletions docs/app/_components/PortalContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
import { useThemeSwitch } from '@/ui/ThemeSwitch';

export const PortalContaier = () => {
const { current } = useThemeSwitch();
const { current, themes } = useThemeSwitch();
const theme = themes[current];

return (
<div data-theme={current}>
<div id="portalContainer" className="not-prose" />
<div id="portalContainer" className={`not-prose ${theme.root?.()}`} />
</div>
);
};
4 changes: 2 additions & 2 deletions docs/ui/ComponentDemo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
OverlayContainerProvider,
Tabs,
} from '@/ui';
import type { ReactNode } from 'react';
import type { ComponentType, ReactNode } from 'react';
import { useThemeSwitch } from '@/ui/ThemeSwitch';

// Props
Expand Down Expand Up @@ -40,7 +40,7 @@ export const ComponentDemo = ({
throw Error(`No demo with name "${name}" found in the registry.`);
}

const Demo = registry[name].demo;
const Demo: ComponentType<{}> = registry[name].demo;
const { current, themes } = useThemeSwitch();

const Wrapper = ({ children }: { children: ReactNode }) =>
Expand Down

0 comments on commit f85bb04

Please sign in to comment.