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

Function CodeOutput

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

Source from the content-addressed store, hash-verified

270}
271
272export 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
304export function CodeProps({indent = ''}) {
305 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