-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
3 changed files
with
64 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
|
||
const IframeSamAuthSamplePage = () => { | ||
return ( | ||
<div> | ||
<iframe src="https://tcrevolution.industrysoftware.automation.siemens.com/" title="ops" width="100%" height="1000px"></iframe> | ||
{/* | ||
<iframe src="https://outlook.live.com/mail/0" title="ops" width="100%" height="1000px"></iframe> | ||
<iframe src="https://tcrevolution.industrysoftware.automation.siemens.com/" title="ops" width="100%" height="1000px"></iframe> | ||
*/} | ||
</div> | ||
); | ||
} | ||
|
||
export default IframeSamAuthSamplePage; | ||
|
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,46 @@ | ||
import { useState } from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
|
||
function PortalStateSamplePage() { | ||
const [toSecContainer, setToSecContainer] = useState(false); | ||
|
||
return ( | ||
<div> | ||
<h1>React Portal State Preservation</h1> | ||
<button onClick={() => setToSecContainer(!toSecContainer)}> | ||
Move Portal to {toSecContainer ? 'First' : 'Second'} Container | ||
</button> | ||
<div id="first-container" style={{ border: '1px solid black', padding: '10px' }}> | ||
<p>First Container</p> | ||
</div> | ||
<div id="second-container" style={{ border: '1px solid red', padding: '10px' }}> | ||
<p>Second Container</p> | ||
</div> | ||
<PortalComponent parentElemId={ toSecContainer ? 'second-container' : 'first-container'} /> | ||
</div> | ||
); | ||
} | ||
|
||
function Parent() { | ||
|
||
return ( | ||
<div> | ||
<h2>Parent Component</h2> | ||
|
||
</div> | ||
); | ||
} | ||
|
||
function PortalComponent({parentElemId}: {parentElemId: string}) { | ||
const [count, setCount] = useState(0); | ||
|
||
return document.getElementById(parentElemId) && ReactDOM.createPortal( | ||
<div> | ||
<p>Portal Component Count: {count}</p> | ||
<button onClick={() => setCount(count + 1)}>Increment</button> | ||
</div>, | ||
document.getElementById(parentElemId) as HTMLElement | ||
); | ||
} | ||
|
||
export default PortalStateSamplePage; |