Refactors to address CR

This commit is contained in:
Ozzie Gooen 2022-06-17 15:47:37 -07:00
parent a563898a5f
commit 38a0e78873
2 changed files with 37 additions and 36 deletions

View File

@ -252,10 +252,10 @@ export const SquiggleItem: React.FC<SquiggleItemProps> = ({
} }
default: { default: {
return ( return (
<> <div>
<span>No display for type: </span>{" "} <span>No display for type: </span>{" "}
<span className="font-semibold text-slate-600">{expression.tag}</span> <span className="font-semibold text-slate-600">{expression.tag}</span>
</> </div>
); );
} }
} }

View File

@ -384,25 +384,31 @@ export const SquigglePlayground: FC<PlaygroundProps> = ({
</div> </div>
); );
const InFirstTab: React.FC<{ children: React.ReactNode }> = ({
children,
}) => (
<Tab.Panels>
<Tab.Panel>{children}</Tab.Panel>
<Tab.Panel>{samplingSettings}</Tab.Panel>
<Tab.Panel>{viewSettings}</Tab.Panel>
<Tab.Panel>{inputVariableSettings}</Tab.Panel>
</Tab.Panels>
);
let withEditor = ( let withEditor = (
<div className="flex mt-1" style={{ height }}> <div className="flex mt-1" style={{ height }}>
<div className="w-1/2"> <div className="w-1/2">
<Tab.Panels> <InFirstTab>
<Tab.Panel> <div className="border border-slate-200">
<div className="border border-slate-200"> <CodeEditor
<CodeEditor value={squiggleString}
value={squiggleString} onChange={setSquiggleString}
onChange={setSquiggleString} oneLine={false}
oneLine={false} showGutter={true}
showGutter={true} height={height - 1}
height={height - 1} />
/> </div>
</div> </InFirstTab>
</Tab.Panel>
<Tab.Panel>{samplingSettings}</Tab.Panel>
<Tab.Panel>{viewSettings}</Tab.Panel>
<Tab.Panel>{inputVariableSettings}</Tab.Panel>
</Tab.Panels>
</div> </div>
<div className="w-1/2 p-2 pl-4"> <div className="w-1/2 p-2 pl-4">
@ -423,24 +429,19 @@ export const SquigglePlayground: FC<PlaygroundProps> = ({
let withoutEditor = ( let withoutEditor = (
<div className="mt-3"> <div className="mt-3">
<Tab.Panels> <InFirstTab>
<Tab.Panel> <SquiggleChart
<SquiggleChart squiggleString={squiggleString}
squiggleString={squiggleString} environment={env}
environment={env} chartSettings={chartSettings}
chartSettings={chartSettings} height={vars.chartHeight}
height={vars.chartHeight} showTypes={vars.showTypes}
showTypes={vars.showTypes} showControls={vars.showControls}
showControls={vars.showControls} bindings={defaultBindings}
bindings={defaultBindings} jsImports={imports}
jsImports={imports} showSummary={vars.showSummary}
showSummary={vars.showSummary} />
/> </InFirstTab>
</Tab.Panel>
<Tab.Panel>{samplingSettings}</Tab.Panel>
<Tab.Panel>{viewSettings}</Tab.Panel>
<Tab.Panel>{inputVariableSettings}</Tab.Panel>
</Tab.Panels>
</div> </div>
); );