feat(dev): Added react docs for Pattern + refactor
This adds support for not only documenating components, but also constants and functions that may be exported next to components.
This commit is contained in:
parent
d0baf7cece
commit
22a89f12d3
50 changed files with 1816 additions and 669 deletions
|
@ -0,0 +1,26 @@
|
|||
import React from 'react'
|
||||
//import * as all from '@freesewing/react/components/Pattern'
|
||||
import { MiniNote } from '@freesewing/react/components/Mini'
|
||||
|
||||
/*
|
||||
* Use this to generate the docs content
|
||||
export const Test = () => {
|
||||
const output = []
|
||||
// list
|
||||
output.push(...Object.keys(all).sort().map(c => `- [${c}](${c.toLowerCase()})`))
|
||||
|
||||
// docs
|
||||
output.push(...Object.keys(all).sort().map(c => `
|
||||
## ${c}
|
||||
<ComponentDocs docs={jsdoc.jsdoc${c}} example={Example} />`))
|
||||
|
||||
return <pre>{output.join("\n")}</pre>
|
||||
}
|
||||
*/
|
||||
|
||||
export const Example = () => (
|
||||
<MiniNote>
|
||||
Components in the Pattern family are tightly coupled with FreeSewing pattern structure.
|
||||
Stand-alone examples are not provided as they are not very relevant.
|
||||
</MiniNote>
|
||||
)
|
|
@ -2,6 +2,126 @@
|
|||
title: Pattern
|
||||
---
|
||||
|
||||
:::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 { FunctionDocs } from '@site/src/components/function-docs.js'
|
||||
import { ConstantDocs } from '@site/src/components/constant-docs.js'
|
||||
import * as jsdoc from '@site/prebuild/jsdoc/components.pattern.mjs'
|
||||
import * as fndoc from '@site/prebuild/jsdoc/functions.pattern.mjs'
|
||||
import * as cdoc from '@site/prebuild/jsdoc/constants.pattern.mjs'
|
||||
import { Example } from './_examples.js'
|
||||
|
||||
<DocusaurusDoc>
|
||||
|
||||
- [Components](#components)
|
||||
- [Constants](#constants)
|
||||
- [Functions](#functions)
|
||||
|
||||
## Components
|
||||
|
||||
The **Pattern** component family provides the following components:
|
||||
|
||||
- [Circle](circle)
|
||||
- [Defs](defs)
|
||||
- [Grid](grid)
|
||||
- [Group](group)
|
||||
- [Part](part)
|
||||
- [Path](path)
|
||||
- [Pattern](pattern)
|
||||
- [Point](point)
|
||||
- [Snippet](snippet)
|
||||
- [Stack](stack)
|
||||
- [Svg](svg)
|
||||
- [Text](text)
|
||||
- [TextOnPath](textonpath)
|
||||
|
||||
## Components
|
||||
|
||||
### Circle
|
||||
|
||||
<ComponentDocs docs={jsdoc.jsdocCircle} example={Example} />
|
||||
|
||||
### Defs
|
||||
|
||||
<ComponentDocs docs={jsdoc.jsdocDefs} example={Example} />
|
||||
|
||||
### Grid
|
||||
|
||||
<ComponentDocs docs={jsdoc.jsdocGrid} example={Example} />
|
||||
|
||||
### Group
|
||||
|
||||
<ComponentDocs docs={jsdoc.jsdocGroup} example={Example} />
|
||||
|
||||
### Part
|
||||
|
||||
<ComponentDocs docs={jsdoc.jsdocPart} example={Example} />
|
||||
|
||||
### Path
|
||||
|
||||
<ComponentDocs docs={jsdoc.jsdocPath} example={Example} />
|
||||
|
||||
### Pattern
|
||||
|
||||
<ComponentDocs docs={jsdoc.jsdocPattern} example={Example} />
|
||||
|
||||
### Point
|
||||
|
||||
<ComponentDocs docs={jsdoc.jsdocPoint} example={Example} />
|
||||
|
||||
### Snippet
|
||||
|
||||
<ComponentDocs docs={jsdoc.jsdocSnippet} example={Example} />
|
||||
|
||||
### Stack
|
||||
|
||||
<ComponentDocs docs={jsdoc.jsdocStack} example={Example} />
|
||||
|
||||
### Svg
|
||||
|
||||
<ComponentDocs docs={jsdoc.jsdocSvg} example={Example} />
|
||||
|
||||
### Text
|
||||
|
||||
<ComponentDocs docs={jsdoc.jsdocText} example={Example} />
|
||||
|
||||
### TextOnPath
|
||||
|
||||
<ComponentDocs docs={jsdoc.jsdocTextOnPath} example={Example} />
|
||||
|
||||
## Constants
|
||||
|
||||
The **Pattern** family exports the following constants:
|
||||
|
||||
- [defaultComponents](defaultcomponents)
|
||||
|
||||
### defaultComponents
|
||||
|
||||
<ConstantDocs docs={cdoc.jsdocdefaultComponents} />
|
||||
|
||||
## Functions
|
||||
|
||||
The **Pattern** family exports the following functions:
|
||||
|
||||
- [getId](getid)
|
||||
- [getProps](getprops)
|
||||
- [translateStrings](translatestrings)
|
||||
- [withinPartBounds](withinpartbounds)
|
||||
|
||||
### getId
|
||||
|
||||
<FunctionDocs docs={fndoc.jsdocgetId} />
|
||||
|
||||
### getProps
|
||||
|
||||
<FunctionDocs docs={fndoc.jsdocgetProps} />
|
||||
|
||||
### translateStrings
|
||||
|
||||
<FunctionDocs docs={fndoc.jsdoctranslateStrings} />
|
||||
|
||||
### withinPartBounds
|
||||
|
||||
<FunctionDocs docs={fndoc.jsdocwithinPartBounds} />
|
||||
|
||||
</DocusaurusDoc>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue