MCPcopy Create free account
hub / github.com/adobe/react-spectrum / CodeOutput

Function CodeOutput

packages/dev/s2-docs/src/VisualExampleClient.tsx:271–301  ·  view source on GitHub ↗
({code, type, showCoachMark}: CodeOutputProps)

Source from the content-addressed store, hash-verified

269}
270
271export 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
303export function CodeProps({indent = ''}) {
304 let {props, controls, propsObject} = useContext(Context);

Callers

nothing calls this directly

Calls 2

renderImportsFunction · 0.85
renderElementFunction · 0.85

Tested by

no test coverage detected