({code, type, showCoachMark}: CodeOutputProps)
| 270 | } |
| 271 | |
| 272 | export function CodeOutput({code, type, showCoachMark}: CodeOutputProps) { |
| 273 | let {name, importSource, props, controls, propsObject} = useContext(Context); |
| 274 | |
| 275 | if (propsObject) { |
| 276 | props = {[propsObject]: props}; |
| 277 | } |
| 278 | |
| 279 | code ||= ( |
| 280 | <div |
| 281 | className={style({ |
| 282 | overflow: 'auto', |
| 283 | '--code-padding-end': { |
| 284 | type: 'paddingEnd', |
| 285 | value: 64 // Extra space for the toolbar |
| 286 | } |
| 287 | })}> |
| 288 | <Pre> |
| 289 | <code style={{fontFamily: 'inherit', WebkitTextSizeAdjust: 'none'}}> |
| 290 | {importSource ? renderImports(name, importSource, props) : null} |
| 291 | {renderElement(name, props, controls)} |
| 292 | </code> |
| 293 | </Pre> |
| 294 | </div> |
| 295 | ); |
| 296 | |
| 297 | return ( |
| 298 | <CodePlatter type={type} showCoachMark={showCoachMark}> |
| 299 | {code} |
| 300 | </CodePlatter> |
| 301 | ); |
| 302 | } |
| 303 | |
| 304 | export function CodeProps({indent = ''}) { |
| 305 | let {props, controls, propsObject} = useContext(Context); |
nothing calls this directly
no test coverage detected