Skip to content

Commit 56e751f

Browse files
committed
Better defaults
1 parent 1fcf595 commit 56e751f

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

packages/mini-editor/src/editor-transition.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,21 @@ import { getTabs } from "./tabs"
1616
export { EditorTransition, EditorTransitionProps }
1717

1818
type EditorTransitionProps = {
19-
prev: EditorStep
20-
next: EditorStep
19+
prev?: EditorStep
20+
next?: EditorStep
2121
t: number
2222
backward: boolean
2323
codeProps: Partial<CodeProps>
2424
} & Omit<EditorFrameProps, "northPanel" | "southPanel">
2525

26+
const DEFAULT_STEP: EditorStep = {
27+
files: [{ code: "", lang: "js", name: "" }],
28+
northPanel: { active: "", tabs: [""], heightRatio: 1 },
29+
}
30+
2631
function EditorTransition({
27-
prev,
28-
next,
32+
prev = DEFAULT_STEP,
33+
next = DEFAULT_STEP,
2934
t,
3035
backward,
3136
codeProps,

packages/mini-editor/src/new-mini-editor.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ function FullMiniEditor(step: FullMiniEditorProps) {
2525
}
2626

2727
function FullMiniEditorHike({
28-
steps,
29-
progress,
30-
backward,
28+
steps = [],
29+
progress = 0,
30+
backward = false,
3131
frameProps,
3232
codeProps,
3333
}: {

0 commit comments

Comments
 (0)