This repository was archived by the owner on Mar 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
fix(whatInput): use proper document to set data-whatinput attr
#1972
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
4f7accd
fix(whatInput): use proper `document` to set `data-whatinput` attr
layershifter 7cd1900
update changelog, add example and screener test
layershifter 4de4c26
fix example to get results in screener
layershifter f52bccf
Merge branch 'master' of https://github.com/stardust-ui/react into fi…
layershifter ab3cd62
fix cruft, add description
layershifter a5ade5a
move steps back
layershifter ed9d334
remove steps
layershifter 251b5e3
wip on example
layershifter 14f58e8
finish example
layershifter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
44 changes: 44 additions & 0 deletions
44
docs/src/examples/components/Provider/Usage/ProviderExampleTargetFrame.tsx
This file contains hidden or 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,44 @@ | ||
| import { Attachment, Button, Provider, themes } from '@stardust-ui/react' | ||
| import * as React from 'react' | ||
| import * as ReactDOM from 'react-dom' | ||
|
|
||
| type PortalFrameProps = { | ||
| children: (externalDocument: Document) => React.ReactElement | ||
| } | ||
|
|
||
| const PortalFrame: React.FunctionComponent<PortalFrameProps> = ({ children }) => { | ||
| const frameRef = React.useRef<HTMLIFrameElement>(null) | ||
| const [mounted, setMounted] = React.useState<boolean>(false) | ||
|
|
||
| React.useEffect(() => { | ||
| setMounted(true) | ||
| }, []) | ||
|
|
||
| return ( | ||
| <> | ||
| <iframe | ||
| ref={frameRef} | ||
| style={{ height: 300, width: 600, border: 0, padding: 20 }} | ||
| title="An example of nested Provider in iframe" | ||
| /> | ||
| {mounted && | ||
| ReactDOM.createPortal( | ||
| children(frameRef.current.contentDocument), | ||
| frameRef.current.contentDocument.body, | ||
| )} | ||
| </> | ||
| ) | ||
| } | ||
|
|
||
| const ProviderExampleTargetFrame = () => ( | ||
| <PortalFrame> | ||
| {externalDocument => ( | ||
| <Provider theme={themes.teams} target={externalDocument}> | ||
| <Attachment actionable header="Document.docx" /> | ||
| <Button content="Hello world!" /> | ||
| </Provider> | ||
| )} | ||
| </PortalFrame> | ||
| ) | ||
|
|
||
| export default ProviderExampleTargetFrame |
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't use
data-whatclasses&data-whatelement, so it's safe to remove them