[react] feat: Added docs for components/Control
This commit is contained in:
parent
34ae1dc8dc
commit
fc04e415c9
6 changed files with 35 additions and 8 deletions
|
@ -505,7 +505,7 @@ export const DesignInfo = ({ Link = false, design = false, noDocsLink = false })
|
||||||
className="tw:daisy-badge tw:daisy-badge-primary tw:font-medium tw:hover:shadow tw:hover:cursor-pointer"
|
className="tw:daisy-badge tw:daisy-badge-primary tw:font-medium tw:hover:shadow tw:hover:cursor-pointer"
|
||||||
href={`/designs/#filter={"example"%3Atrue%2C"tag"%3A["${tag}"]}`}
|
href={`/designs/#filter={"example"%3Atrue%2C"tag"%3A["${tag}"]}`}
|
||||||
>
|
>
|
||||||
{tag}
|
<span className="tw:text-primary-content">{tag}</span>
|
||||||
</Link>
|
</Link>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
@ -517,7 +517,7 @@ export const DesignInfo = ({ Link = false, design = false, noDocsLink = false })
|
||||||
className="tw:daisy-badge tw:daisy-badge-accent tw:font-medium tw:hover:shadow tw:hover:cursor-pointer"
|
className="tw:daisy-badge tw:daisy-badge-accent tw:font-medium tw:hover:shadow tw:hover:cursor-pointer"
|
||||||
href={`/designs/#filter={"example"%3Atrue%2C"tag"%3A["${tech}"]}`}
|
href={`/designs/#filter={"example"%3Atrue%2C"tag"%3A["${tech}"]}`}
|
||||||
>
|
>
|
||||||
{tech}
|
<span className="tw:text-accent-content">{tech}</span>
|
||||||
</Link>
|
</Link>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -2,9 +2,17 @@ import React from 'react'
|
||||||
import { controlDesc } from '@freesewing/config'
|
import { controlDesc } from '@freesewing/config'
|
||||||
import { BulletIcon } from '@freesewing/react/components/Icon'
|
import { BulletIcon } from '@freesewing/react/components/Icon'
|
||||||
|
|
||||||
export const ControlScore = ({ control, color = 'base-content' }) =>
|
/**
|
||||||
|
* A component to render a visualisation of the user's control/UX setting
|
||||||
|
*
|
||||||
|
* @component
|
||||||
|
* @param {object} props - All component props
|
||||||
|
* @param {number} props.control - The user's control setting (a number)
|
||||||
|
* @returns {JSX.Element}
|
||||||
|
*/
|
||||||
|
export const ControlScore = ({ control }) =>
|
||||||
control ? (
|
control ? (
|
||||||
<div className={`tw:flex tw:flex-row tw:items-center tw:text-${color}`}>
|
<div className={`tw:flex tw:flex-row tw:items-center tw:text-base-content`}>
|
||||||
{Object.keys(controlDesc).map((score) => (
|
{Object.keys(controlDesc).map((score) => (
|
||||||
<BulletIcon
|
<BulletIcon
|
||||||
fill={control >= score ? true : false}
|
fill={control >= score ? true : false}
|
||||||
|
|
|
@ -6,3 +6,4 @@ jsdoc -c jsdoc.json components/Admin/* > ../../sites/dev/prebuild/jsdoc/react/co
|
||||||
jsdoc -c jsdoc.json components/Breadcrumbs/* > ../../sites/dev/prebuild/jsdoc/react/components/breadcrumbs.json
|
jsdoc -c jsdoc.json components/Breadcrumbs/* > ../../sites/dev/prebuild/jsdoc/react/components/breadcrumbs.json
|
||||||
jsdoc -c jsdoc.json components/Button/* > ../../sites/dev/prebuild/jsdoc/react/components/button.json
|
jsdoc -c jsdoc.json components/Button/* > ../../sites/dev/prebuild/jsdoc/react/components/button.json
|
||||||
jsdoc -c jsdoc.json components/Collection/* > ../../sites/dev/prebuild/jsdoc/react/components/collection.json
|
jsdoc -c jsdoc.json components/Collection/* > ../../sites/dev/prebuild/jsdoc/react/components/collection.json
|
||||||
|
jsdoc -c jsdoc.json components/Control/* > ../../sites/dev/prebuild/jsdoc/react/components/control.json
|
||||||
|
|
|
@ -15,10 +15,10 @@ The **Collection** component family provides the following components:
|
||||||
- [DesignInfo](#designinfo)
|
- [DesignInfo](#designinfo)
|
||||||
|
|
||||||
## Collection
|
## Collection
|
||||||
|
|
||||||
<ComponentDocs docs={jsdocCollection} example={CollectionExample} />
|
<ComponentDocs docs={jsdocCollection} example={CollectionExample} />
|
||||||
|
|
||||||
## DesignInfo
|
## DesignInfo
|
||||||
|
<ComponentDocs docs={jsdocDesignInfo} example={DesignInfoExample} />
|
||||||
|
|
||||||
</DocusaurusDoc>
|
</DocusaurusDoc>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
import React from 'react'
|
||||||
|
import { ControlScore } from '@freesewing/react/components/Control'
|
||||||
|
|
||||||
|
export const ControlScoreExample = () => <ControlScore control={3} />
|
|
@ -2,6 +2,20 @@
|
||||||
title: Control
|
title: Control
|
||||||
---
|
---
|
||||||
|
|
||||||
:::note
|
import { DocusaurusDoc } from '@freesewing/react/components/Docusaurus'
|
||||||
This page is yet to be created
|
import { ComponentDocs } from '@site/src/components/component-docs.js'
|
||||||
:::
|
import { jsdocControlScore } from '@site/prebuild/jsdoc/components.control.mjs'
|
||||||
|
import { ControlScoreExample } from './_examples.js'
|
||||||
|
|
||||||
|
<DocusaurusDoc>
|
||||||
|
|
||||||
|
The **Control** component family provides the following components:
|
||||||
|
|
||||||
|
- [ControlScore](#controlscore)
|
||||||
|
|
||||||
|
## ControlScore
|
||||||
|
|
||||||
|
<ComponentDocs docs={jsdocControlScore} example={ControlScoreExample} />
|
||||||
|
|
||||||
|
</DocusaurusDoc>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue