editor
editor copied to clipboard
Run button is not present if Preview component is not set.
Given the following sandpackConfig
const sandpackConfig = {
defaultPreset: "default",
presets: [
{
name: "default",
meta: "live",
label: "TypeScript",
sandpackTemplate: "vanilla-ts",
sandpackTheme: "light",
snippetFileName: "/index.ts",
snippetLanguage: "ts",
initialSnippetContent: [
'import "./styles.css";',
'document.getElementById("app").innerHTML = `<h1>Hello world</h1>`;',
].join("\n"),
},
],
panes: {
console: true,
preview: false,
},
};
I guess the need for the solution where we pass down the Sandpack Panels as components instead of just flags is surfacing, as this setting is something we'd have to change on the SandpackCodeEditor by adding showRunButton prop.
I think it's better to go for a React.ComponentType prop in SandpackConfig that gets rendered so that the developer can adjust the Sandpack configuration up to their needs.
Should not be hard to do so, I think I will be able to get to that this week. Happy to accept a PR as well.
I'll be fixing up some other personal projects, feel free to wait for a PR from me if it's not urgent and no-one else is bothered by this.