Skip to content
This repository has been archived by the owner on Oct 30, 2022. It is now read-only.

WIP Add sandbox from unmock-examples. #4

Open
wants to merge 3 commits into
base: source
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions website/pages/en/sandbox.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const React = require("react");

// Use the CompLibrary from Docusaurus
// https://docusaurus.io/docs/en/api-pages#page-require-paths
const CompLibrary = require("../../core/CompLibrary.js");

const iframe = `<iframe src="https://codesandbox.io/embed/n9m2w9q8x0?fontsize=14" title="Jest test" allow="geolocation; microphone; camera; midi; vr; accelerometer; gyroscope; payment; ambient-light-sensor; encrypted-media" style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;" sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin"></iframe>`;

const Container = CompLibrary.Container;

class Sandbox extends React.Component {
render() {
// Can access siteConfig.js from here as follows
// const { config: siteConfig } = this.props;

return (
<div className="mainContainer">
<Container padding={["bottom", "top"]}>
<div dangerouslySetInnerHTML={{ __html: iframe }} />
</Container>
</div>
);
}
}

module.exports = Sandbox;
1 change: 1 addition & 0 deletions website/siteConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const siteConfig = {
// For no header links in the top nav bar -> headerLinks: [],
headerLinks: [
{ doc: "introduction", label: "Docs" },
{ page: "sandbox", label: "Sandbox" },
{ href: "https://github.com/unmock/unmock-js", label: "GitHub" },
],

Expand Down