Skip to content

Commit

Permalink
Restore shared code and add types
Browse files Browse the repository at this point in the history
  • Loading branch information
ezzatron committed Jul 9, 2022
1 parent a5f9929 commit eb926d0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"publishConfig": {
"access": "public"
},
"types": "src/main.d.ts",
"main": "src/main.js",
"exports": {
".": "./src/main.js",
Expand Down
14 changes: 14 additions & 0 deletions src/main.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
declare module "@theme/Sandbox" {
interface Props {
codeMirror?: boolean;
height: string;
hideDevTools?: boolean;
id: string;
inline?: boolean;
previewWindow?: string;
}

export default function Sandbox(props: Props): JSX.Element;
}

export function buildUrl(id: string): string;
10 changes: 10 additions & 0 deletions src/sandbox.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
buildUrl,
};

function buildUrl(id) {
const url = new URL("https://codesandbox.io/");
url.pathname = `/s/${id}`;

return url.toString();
}

0 comments on commit eb926d0

Please sign in to comment.