Skip to content

Commit

Permalink
feat: Update SandpackConsole
Browse files Browse the repository at this point in the history
Added showRestartButton and showResetConsoleButton props, and removed showResetButton prop in SandpackConsole component
  • Loading branch information
danilowoz committed Nov 27, 2023
1 parent adb90d8 commit a9d72a2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
10 changes: 6 additions & 4 deletions sandpack-react/src/components/Console/SandpackConsole.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ interface SandpackConsoleProps {
showHeader?: boolean;
showSyntaxError?: boolean;
showSetupProgress?: boolean;
showResetButton?: boolean;
showRestartButton?: boolean;
showResetConsoleButton?: boolean;
maxMessageCount?: number;
onLogsChange?: (logs: SandpackConsoleData) => void;
resetOnPreviewRestart?: boolean;
Expand Down Expand Up @@ -52,7 +53,8 @@ export const SandpackConsole = React.forwardRef<
onLogsChange,
className,
showSetupProgress = false,
showResetButton = true,
showResetConsoleButton = true,
showRestartButton = true,
resetOnPreviewRestart = false,
actionsChildren = <></>,
standalone = false,
Expand Down Expand Up @@ -168,7 +170,7 @@ export const SandpackConsole = React.forwardRef<
>
{actionsChildren}

{isServerTab && (
{showRestartButton && isServerTab && (
<RoundedButton
onClick={(): void => {
restart();
Expand All @@ -180,7 +182,7 @@ export const SandpackConsole = React.forwardRef<
</RoundedButton>
)}

{showResetButton && (
{showResetConsoleButton && (
<RoundedButton
onClick={(): void => {
if (currentTab === "client") {
Expand Down
5 changes: 3 additions & 2 deletions website/docs/src/pages/advanced-usage/components.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -578,10 +578,11 @@ export default () => (
| Prop | Description | Type | Default |
| :---------------------- | :--------------------------------------------------------------------------------------- | :------------------------------------ | :------------------- |
| `clientId` | | `string` | `undefined` |
| `clientId` | | `string` | `undefined` |
| `showHeader` | | `boolean` | `true` |
| `showSyntaxError` | | `boolean` | `false` |
| `showResetButton` | | `boolean` | `true` |
| `showResetConsoleButton` | | `boolean` | `true` |
| `showRestartButton` | | `boolean` | `true` |
| `maxMessageCount` | | `number` | `800` |
| `onLogsChange` | | `(logs: SandpackConsoleData) => void` | |
| `resetOnPreviewRestart` | Reset the console list on every preview restart | `boolean` | `false` |
Expand Down

0 comments on commit a9d72a2

Please sign in to comment.