1
0
Fork 0

[react] feat: Added docs for components/Xray

This commit is contained in:
joostdecock 2025-05-29 14:12:20 +02:00
parent 5e5d3a0270
commit 0a345b3347
5 changed files with 64 additions and 7 deletions

View file

@ -17,7 +17,7 @@ import { getId, getProps, withinPartBounds, translateStrings } from './utils.mjs
import { Link as WebLink } from '@freesewing/react/components/Link'
/**
* Default pattern components that you can override
* Default Pattern components that you can override
*
* @public
* @constant
@ -45,7 +45,7 @@ const defaultComponents = {
* @param {JSX.Element} props.children - The component children, if they are set, we will not render any stacks
* @param {string} [props.className = 'freesewing pattern'] - SVG classes to set on the SVG element
* @param {object} [props.components = {}] - Any custom components to use in the pattern
* @param {object} [props.string = {}] - Strings to use for translation
* @param {object} [props.strings = {}] - Strings to use for translation
* @param {object} props.renderProps - The pattern's renderProps as generated by FreeSewing core
* @returns {JSX.Element}
*/

View file

@ -3,14 +3,30 @@ import { defaultComponents as patternComponents } from '@freesewing/react/compon
import { PointXray } from './point.mjs'
import { PathXray } from './path.mjs'
/*
* Allow people to override these components
/**
* Default Xray components that you can override
*
* @public
* @constant
*/
const defaultComponents = {
Point: PointXray,
Path: PathXray,
}
/**
* A component to code-highlight JSON data
*
* @component
* @param {object} props - All component props
* @param {JSX.Element} props.children - The component children, if they are set, we will not render any stacks
* @param {string} [props.className = 'freesewing pattern'] - SVG classes to set on the SVG element
* @param {object} [props.components = {}] - Any custom components to use in the pattern
* @param {object} [props.drillProps = {}] - Any additional props to pass down
* @param {object} [props.strings = {}] - Strings to use for translation
* @param {object} props.renderProps - The pattern's renderProps as generated by FreeSewing core
* @returns {JSX.Element}
*/
export const Xray = forwardRef((props, ref) => {
if (!props.renderProps) return null

View file

@ -41,3 +41,4 @@ jsdoc -c jsdoc.json components/Table/* > ../../sites/dev/prebuild/jsdoc/react/co
jsdoc -c jsdoc.json components/Time/* > ../../sites/dev/prebuild/jsdoc/react/components/time.json
jsdoc -c jsdoc.json components/Uuid/* > ../../sites/dev/prebuild/jsdoc/react/components/uuid.json
jsdoc -c jsdoc.json components/Ux/* > ../../sites/dev/prebuild/jsdoc/react/components/ux.json
jsdoc -c jsdoc.json components/Xray/* > ../../sites/dev/prebuild/jsdoc/react/components/xray.json

View file

@ -0,0 +1,10 @@
import React from 'react'
import { MiniNote } from '@freesewing/react/components/Mini'
export const Example = () => (
<MiniNote>
Components in the Xray family are tightly coupled with FreeSewing pattern structure.
Stand-alone examples are not provided as they are not very relevant.
</MiniNote>
)

View file

@ -2,6 +2,36 @@
title: Xray
---
:::note
This page is yet to be created
:::
import { DocusaurusDoc } from '@freesewing/react/components/Docusaurus'
import { ComponentDocs } from '@site/src/components/component-docs.js'
import { ConstantDocs } from '@site/src/components/constant-docs.js'
import * as jsdoc from '@site/prebuild/jsdoc/components.xray.mjs'
import * as cdoc from '@site/prebuild/jsdoc/constants.xray.mjs'
import { Example } from './_examples.js'
<DocusaurusDoc>
- [Components](#components)
- [Constants](#constants)
## Components
The **Xray** component family provides the following components:
- [Xray](#json)
### Xray
<ComponentDocs docs={jsdoc.jsdocXray} example={Example} />
## Constants
The **Xray** family exports the following constants:
- [defaultComponents](defaultcomponents)
### defaultComponents
<ConstantDocs docs={cdoc.jsdocdefaultComponents} />
</DocusaurusDoc>