-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove usePortal, related components use Portal refactoring (include Command Dialog Drawer Tooltip ...) re #1
- Loading branch information
Showing
22 changed files
with
190 additions
and
130 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
export * from './useAction' | ||
export * from './useClickOutside' | ||
export * from './usePortal' | ||
export * from './useReveal' | ||
export * from './usePopper' | ||
export * from './useHover' | ||
export * from './useClick' | ||
export * from './useTouch' | ||
export * from './useFocus' | ||
export * from './useMedia' | ||
export * from './useGlobal' |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export function useGlobal(): Window | NodeJS.Global { | ||
return typeof window !== 'undefined' ? window : global | ||
} |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
38 changes: 38 additions & 0 deletions
38
packages/fluent-ui.com/src/docs/components/Portal/README.md
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
title: Portal | ||
components: Portal | ||
type: Utils | ||
--- | ||
|
||
# Portal | ||
|
||
<p class="description">The portal component renders its children into a new "subtree" outside of current component hierarchy. | ||
</p> | ||
|
||
## Simple Portal | ||
|
||
```jsx | ||
() => { | ||
const [show, setShow] = React.useState(false) | ||
const container = React.useRef(null) | ||
|
||
function handleClick() { | ||
setShow(!show) | ||
} | ||
|
||
return ( | ||
<Box> | ||
<Button onClick={handleClick}>{show ? 'Unmount' : 'Mount'}</Button> | ||
<Box> | ||
<Typography>It looks like I will render here?</Typography> | ||
{show ? ( | ||
<Portal container={container.current}> | ||
<Typography>Actually render here!</Typography> | ||
</Portal> | ||
) : null} | ||
</Box> | ||
<Box ref={container} /> | ||
</Box> | ||
) | ||
} | ||
``` |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
title: Portal | ||
components: Portal | ||
api: true | ||
--- | ||
|
||
## API | ||
|
||
``` | ||
import Portal from '@fluent-ui/core/Portal' | ||
// or | ||
import { Portal } from '@fluent-ui/core' | ||
``` | ||
|
||
### Props | ||
|
||
| Name | Type | Default | Description | | ||
| --- | --- | --- | --- | | ||
| children * | React.ReactElement | | The children to render into the `container`. | | ||
| container | Element ∨ (() => Element) ∨ null | | A node, component instance, or function that returns either. The `container` will have the portal children appended to it. By default, it uses the body of the top-level document object, so it's simply `document.body` most of the time. | | ||
| disablePortal | boolean | false | Disable the portal behavior. The children stay within it's parent DOM hierarchy. | |
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
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
Oops, something went wrong.