Skip to content

Commit

Permalink
Update 3 files
Browse files Browse the repository at this point in the history
  • Loading branch information
danilowoz committed Apr 1, 2023
1 parent fcf31f1 commit 72cca4a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 19 deletions.
6 changes: 3 additions & 3 deletions sandpack-client/src/clients/runtime/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ const BUNDLER_URL =
process.env.CODESANDBOX_ENV === "development"
? "http://localhost:3000/"
: `https://${process.env.PACKAGE_VERSION?.replace(
/\./g,
"-"
)}-sandpack.codesandbox.io/`;
/\./g,
"-"
)}-sandpack.codesandbox.io/`;

export class SandpackRuntime extends SandpackClient {
fileResolverProtocol?: Protocol;
Expand Down
41 changes: 26 additions & 15 deletions sandpack-react/src/components/Console/Console.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ console.log("foo");`,
);

export const MaxMessageCount = () => {
const [mode, setMode] = useState('client');
const [mode, setMode] = useState("client");
const [maxMessageCount, setMaxMessageCount] = useState(5);

return (
Expand All @@ -198,29 +198,40 @@ export const MaxMessageCount = () => {
}),
}}
options={{ visibleFiles: ["/index.js"], recompileDelay: 500 }}
template={mode === 'client' ? 'vanilla' : 'node'}
template={mode === "client" ? "vanilla" : "node"}
>
<SandpackLayout>
<SandpackCodeEditor />
<SandpackConsole standalone maxMessageCount={Number(maxMessageCount)} />
<SandpackConsole
standalone
maxMessageCount={Number(maxMessageCount)}
/>
</SandpackLayout>
<div style={{
marginTop: 32,
display: 'flex',
flexDirection: 'column',
gap: 8,
justifyItems: 'left',
width: 'fit-content'
}}>
<button onClick={() => setMode(mode === 'client' ? 'server' : 'client')}>
<div
style={{
marginTop: 32,
display: "flex",
flexDirection: "column",
gap: 8,
justifyItems: "left",
width: "fit-content",
}}
>
<button
onClick={() => setMode(mode === "client" ? "server" : "client")}
>
Toggle mode: {mode}
</button>
<label style={{ display: 'flex', flexDirection: 'column', gap: 4 }}>
<label style={{ display: "flex", flexDirection: "column", gap: 4 }}>
<span>Max Message Count</span>
<input type="number" value={maxMessageCount} onChange={e => setMaxMessageCount(+e.target.value)} />
<input
type="number"
value={maxMessageCount}
onChange={(e) => setMaxMessageCount(+e.target.value)}
/>
</label>
</div>
</SandpackProvider>
</>
);
}
};
2 changes: 1 addition & 1 deletion sandpack-react/src/components/Console/SandpackConsole.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export const SandpackConsole = React.forwardRef<
)}
{...props}
>
{(showHeader && isNodeEnvironment) && (
{showHeader && isNodeEnvironment && (
<Header
currentTab={currentTab}
node={isNodeEnvironment}
Expand Down

0 comments on commit 72cca4a

Please sign in to comment.