Skip to content
Source
Sign inSign up
TanStack/table
Open History to see the last commit

CodeSandbox.js

41 lines1.0 KB

1import React from "react";
2​
3export const CodeSandbox = name => () => {
4 return (
5 <iframe
6 src={`https://codesandbox.io/embed/github/tannerlinsley/react-table/tree/v6/examples/${name}?autoresize=1&hidenavigation=1&view=${
7 global.innerWidth < 1000 ? "preview" : "split"
8 }`}
9 style={{
10 position: "absolute",
11 top: 0,
12 left: 0,
13 width: `100%`,
14 height: `100%`,
15 border: 0,
16 overflow: `hidden`
17 }}
18 sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin"
19 />
20 );
21};
22​
23export const CodeSandboxId = id => () => {
24 return (
25 <iframe
26 src={`https://codesandbox.io/embed/${id}?autoresize=1&hidenavigation=1&view=${
27 global.innerWidth < 1000 ? "preview" : "split"
28 }`}
29 style={{
30 position: "absolute",
31 top: 0,
32 left: 0,
33 width: `100%`,
34 height: `100%`,
35 border: 0,
36 overflow: `hidden`
37 }}
38 sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin"
39 />
40 );
41};