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