Open sapegin opened 4 years ago
@sapegin , we used https://www.npmjs.com/package/react-frame-component about 1.5 year ago, it was not bad.
This could help for sharing the styles between iframe
import Frame from "react-frame-component";
const initialContent = `<!DOCTYPE html><html><head>${document.head.innerHTML}</head><body><div></div></body></html>`;
<Frame style={{ width: "80%", margin: "auto 10%" }} initialContent={initialContent}>
<YourComponent title="Title" />
</Frame>;
The main goal of using iframes is to prevent sharing anything between the host and iframes.
There's a pull request with draft implementation: #1553.
Right now each example is a separate React app that renders into the same DOM as the Styleguidist app itself. This approach have some problems:
Possible issues of the iframe approach: