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