-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(react-portal): refactor portals creation
- Loading branch information
1 parent
3d044da
commit 55f1dbe
Showing
8 changed files
with
116 additions
and
167 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
11 changes: 0 additions & 11 deletions
11
...-components/react-portal/library/src/components/Portal/__snapshots__/Portal.test.tsx.snap
This file was deleted.
Oops, something went wrong.
11 changes: 9 additions & 2 deletions
11
packages/react-components/react-portal/library/src/components/Portal/renderPortal.tsx
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,14 +1,21 @@ | ||
/** @jsxRuntime automatic */ | ||
/** @jsxImportSource @fluentui/react-jsx-runtime */ | ||
import { assertSlots } from '@fluentui/react-utilities'; | ||
import * as ReactDOM from 'react-dom'; | ||
import * as React from 'react'; | ||
import type { PortalState } from './Portal.types'; | ||
|
||
import type { PortalState, PortalInternalSlots } from './Portal.types'; | ||
|
||
/** | ||
* Render the final JSX of Portal | ||
*/ | ||
export const renderPortal_unstable = (state: PortalState): React.ReactElement => { | ||
assertSlots<PortalInternalSlots>(state); | ||
|
||
return ( | ||
<span hidden ref={state.virtualParentRootRef}> | ||
{state.mountNode && ReactDOM.createPortal(state.children, state.mountNode)} | ||
{state.mountNode && | ||
ReactDOM.createPortal(state.root ? <state.root>{state.children}</state.root> : state.children, state.mountNode)} | ||
</span> | ||
); | ||
}; |
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
37 changes: 0 additions & 37 deletions
37
...s/react-components/react-portal/library/src/components/Portal/usePortalMountNode.test.tsx
This file was deleted.
Oops, something went wrong.
91 changes: 0 additions & 91 deletions
91
packages/react-components/react-portal/library/src/components/Portal/usePortalMountNode.ts
This file was deleted.
Oops, something went wrong.