|  | 
| 1 | 1 | import React from "react" | 
| 2 | 2 | import { CodeBrowser } from "./code-browser" | 
| 3 | 3 | import { EditorStep } from "./editor-shift" | 
|  | 4 | +import { CodeStep } from "../smooth-code/code-tween" | 
| 4 | 5 | 
 | 
| 5 |  | -export function ExpandButton({ | 
| 6 |  | -  style, | 
|  | 6 | +export function EditorExpandButton({ | 
| 7 | 7 |   step, | 
| 8 |  | -  className, | 
|  | 8 | +  ...props | 
| 9 | 9 | }: { | 
| 10 | 10 |   style?: React.CSSProperties | 
| 11 | 11 |   step: EditorStep | 
| 12 | 12 |   className?: string | 
|  | 13 | +}) { | 
|  | 14 | +  const files = step.files | 
|  | 15 | +  const activeFileName = step.northPanel.active | 
|  | 16 | + | 
|  | 17 | +  return ( | 
|  | 18 | +    <ExpandButton | 
|  | 19 | +      {...props} | 
|  | 20 | +      files={step.files} | 
|  | 21 | +      activeFileName={step.northPanel?.active} | 
|  | 22 | +    /> | 
|  | 23 | +  ) | 
|  | 24 | +} | 
|  | 25 | + | 
|  | 26 | +export function CodeExpandButton({ | 
|  | 27 | +  step, | 
|  | 28 | +  ...props | 
|  | 29 | +}: { | 
|  | 30 | +  style?: React.CSSProperties | 
|  | 31 | +  step: CodeStep | 
|  | 32 | +  className?: string | 
|  | 33 | +}) { | 
|  | 34 | +  const file = { ...step, name: "" } | 
|  | 35 | +  const activeFileName = "" | 
|  | 36 | + | 
|  | 37 | +  return ( | 
|  | 38 | +    <ExpandButton | 
|  | 39 | +      {...props} | 
|  | 40 | +      files={[file]} | 
|  | 41 | +      activeFileName={activeFileName} | 
|  | 42 | +    /> | 
|  | 43 | +  ) | 
|  | 44 | +} | 
|  | 45 | + | 
|  | 46 | +function ExpandButton({ | 
|  | 47 | +  style, | 
|  | 48 | +  className, | 
|  | 49 | +  files, | 
|  | 50 | +  activeFileName, | 
|  | 51 | +}: { | 
|  | 52 | +  style?: React.CSSProperties | 
|  | 53 | +  files: EditorStep["files"] | 
|  | 54 | +  activeFileName: string | 
|  | 55 | +  className?: string | 
| 13 | 56 | }) { | 
| 14 | 57 |   const [expanded, setExpanded] = React.useState(false) | 
| 15 | 58 |   const [dialogSupported, setDialogSupported] = | 
| 16 | 59 |     React.useState(true) | 
| 17 | 60 |   const ref = React.useRef<any>(null) | 
| 18 |  | -  const files = step.files | 
| 19 | 61 | 
 | 
| 20 | 62 |   // check if <dialog /> is supported | 
| 21 | 63 |   React.useEffect(() => { | 
| @@ -62,7 +104,7 @@ export function ExpandButton({ | 
| 62 | 104 |           <div className="ch-expand-dialog-content"> | 
| 63 | 105 |             <CodeBrowser | 
| 64 | 106 |               files={files} | 
| 65 |  | -              startingFileName={step.northPanel.active} | 
|  | 107 | +              startingFileName={activeFileName} | 
| 66 | 108 |             /> | 
| 67 | 109 |           </div> | 
| 68 | 110 |         ) : undefined} | 
|  | 
0 commit comments