MCPcopy Create free account
hub / github.com/chakra-ui/panda / generateJsxExample

Function generateJsxExample

packages/generator/src/shared.ts:61–73  ·  view source on GitHub ↗
(
  props: Record<string, string | null | undefined>,
  jsxStyleProps: JsxStyleProps = 'all',
  component = 'Box',
)

Source from the content-addressed store, hash-verified

59 * Generates a single JSX example based on jsxStyleProps setting
60 */
61export const generateJsxExample = (
62 props: Record<string, string | null | undefined>,
63 jsxStyleProps: JsxStyleProps = 'all',
64 component = 'Box',
65): string | null => {
66 if (jsxStyleProps === 'all') {
67 return formatJsxComponent(component, props)
68 }
69 if (jsxStyleProps === 'minimal') {
70 return `<${component} css={{ ${formatProps(props)} }} />`
71 }
72 return null
73}
74
75/**
76 * Generates function and JSX examples for a style property

Callers 4

generateTokenExamplesFunction · 0.90
generateColorPaletteSpecFunction · 0.90
generateJsxExamplesFunction · 0.85

Calls 2

formatJsxComponentFunction · 0.85
formatPropsFunction · 0.85

Tested by

no test coverage detected