-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2333710
commit c102c41
Showing
5 changed files
with
26 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,21 @@ | ||
import { usePageContext } from './page.context'; | ||
|
||
interface UsePortalContainerReturnType { | ||
darkThemePortalContainer?: HTMLElement; | ||
lightThemePortalContainer?: HTMLElement; | ||
} | ||
import type { PageContextValue } from './page.context'; | ||
|
||
/** | ||
* **Important**: This is for Storybook use only. In real app everything will be placed in context of a single | ||
* ThemeProvider. It should be used with all components that create portals to fix LocalThemeProvider with dark theme | ||
* and Interaction tests (without this approach your component may not be accessible using `canvas.getByTestId()`). | ||
*/ | ||
export const usePortalContainer = (): UsePortalContainerReturnType => ({ | ||
darkThemePortalContainer: usePageContext().darkThemePortalContainer, | ||
lightThemePortalContainer: usePageContext().lightThemePortalContainer, | ||
}); | ||
export const usePortalContainer = (): Pick< | ||
PageContextValue, | ||
'darkThemePortalContainer' | 'lightThemePortalContainer' | ||
> => { | ||
const { lightThemePortalContainer, darkThemePortalContainer } = | ||
usePageContext(); | ||
|
||
return { | ||
darkThemePortalContainer, | ||
lightThemePortalContainer, | ||
}; | ||
}; |
4 changes: 2 additions & 2 deletions
4
packages/ui/src/design-system/select/select-item/select-item-root.component.css.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
packages/ui/src/design-system/select/select-root.component.css.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters