1
0
Fork 0

[react] feat: Added docs for components/Json

This commit is contained in:
joostdecock 2025-05-24 12:22:21 +02:00
parent b914b6299f
commit 1b1cacdea3
4 changed files with 46 additions and 3 deletions

View file

@ -2,6 +2,15 @@ import React from 'react'
import { Highlight } from '@freesewing/react/components/Highlight'
import hljs from 'highlight.js/lib/common'
/**
* A component to code-highlight JSON data
*
* @component
* @param {object} props - All component props
* @param {object} [props.js = undefined] - An optional Javascript Object to highlight
* @param {JSX.Element} props.children - The component children, will be rendered if props.js is not set
* @returns {JSX.Element}
*/
export const Json = (props) => {
const code = props.js ? JSON.stringify(props.js, null, 2) : props.children

View file

@ -15,3 +15,4 @@ jsdoc -c jsdoc.json components/Heading/* > ../../sites/dev/prebuild/jsdoc/react/
jsdoc -c jsdoc.json components/Highlight/* > ../../sites/dev/prebuild/jsdoc/react/components/highlight.json
jsdoc -c jsdoc.json components/Icon/* > ../../sites/dev/prebuild/jsdoc/react/components/icon.json
jsdoc -c jsdoc.json components/Input/* > ../../sites/dev/prebuild/jsdoc/react/components/input.json
jsdoc -c jsdoc.json components/Json/* > ../../sites/dev/prebuild/jsdoc/react/components/json.json