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

Function CodeOutput

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

Source from the content-addressed store, hash-verified

265}
266
267export 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
299export function CodeProps({indent = ''}) {
300 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