Skip to content

Commit

Permalink
Update Playground.stories.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
danilowoz committed Apr 3, 2023
1 parent b956117 commit 20f62b8
Showing 1 changed file with 2 additions and 36 deletions.
38 changes: 2 additions & 36 deletions sandpack-react/src/Playground.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
import * as themes from "@codesandbox/sandpack-themes";
import React from "react";

import { SandpackCodeEditor, SandpackPreview } from "./components";
import { useSandpack } from "./hooks";
import { SandpackCodeEditor, SandpackConsole } from "./components";

import { Sandpack, SandpackProvider } from "./";
import { Sandpack, SandpackLayout, SandpackProvider } from "./";

export default {
title: "Intro/Playground",
Expand Down Expand Up @@ -46,36 +45,3 @@ console.log("foo");`,
template="node"
/>
);

export const RunExample = () => {
return (
<div className="App">
<SandpackProvider
options={{
autorun: false,
}}
template="vanilla-ts"
>
<SandpackCodeEditor />
<SandpackPreview />
<RunButton />
</SandpackProvider>
</div>
);
};

// Allows running sandpack programatically
// However, the bug is that the values are stale:
function RunButton() {
const { sandpack } = useSandpack();

return (
<button
onClick={() => {
sandpack.runSandpack();
}}
>
Run
</button>
);
}

0 comments on commit 20f62b8

Please sign in to comment.