1
0
Fork 0

[react] feat: Added docs for components/Mini

This commit is contained in:
joostdecock 2025-05-24 18:03:59 +02:00
parent 17619aebcb
commit 7317ff5dd8
4 changed files with 66 additions and 2 deletions

View file

@ -1,6 +1,14 @@
import React from 'react'
import { TipIcon, ChatIcon, WarningIcon } from '@freesewing/react/components/Icon'
/**
* A component to display a mini tip
*
* @component
* @param {object} props - All component props
* @param {JSX.Element} props.children - The component children, will be rendered inside the mini tip
* @returns {JSX.Element}
*/
export const MiniTip = ({ children }) => (
<div className="tw:flex tw:flex-row tw:border tw:border-success tw:rounded">
<div className="tw:bg-success tw:text-success-content tw:p-1 tw:rounded-l tw:flex tw:flex-row tw:items-center">
@ -12,6 +20,14 @@ export const MiniTip = ({ children }) => (
</div>
)
/**
* A component to display a mini note
*
* @component
* @param {object} props - All component props
* @param {JSX.Element} props.children - The component children, will be rendered inside the mini note
* @returns {JSX.Element}
*/
export const MiniNote = ({ children }) => (
<div className="tw:flex tw:flex-row tw:border tw:border-info tw:rounded">
<div className="tw:bg-info tw:text-info-content tw:p-1 tw:rounded-l tw:flex tw:flex-row tw:items-center">
@ -23,6 +39,14 @@ export const MiniNote = ({ children }) => (
</div>
)
/**
* A component to display a mini warning
*
* @component
* @param {object} props - All component props
* @param {JSX.Element} props.children - The component children, will be rendered inside the mini warning
* @returns {JSX.Element}
*/
export const MiniWarning = ({ children }) => (
<div className="tw:flex tw:flex-row tw:border tw:border-warning tw:rounded">
<div className="tw:bg-warning tw:text-warning-content tw:p-1 tw:rounded-l tw:flex tw:flex-row tw:items-center">

View file

@ -21,3 +21,4 @@ jsdoc -c jsdoc.json components/Layout/* > ../../sites/dev/prebuild/jsdoc/react/c
jsdoc -c jsdoc.json components/LineDrawing/* > ../../sites/dev/prebuild/jsdoc/react/components/linedrawing.json
jsdoc -c jsdoc.json components/Link/* > ../../sites/dev/prebuild/jsdoc/react/components/link.json
jsdoc -c jsdoc.json components/Logo/* > ../../sites/dev/prebuild/jsdoc/react/components/logo.json
jsdoc -c jsdoc.json components/Mini/* > ../../sites/dev/prebuild/jsdoc/react/components/mini.json

View file

@ -0,0 +1,6 @@
import React from 'react'
import { MiniNote, MiniTip, MiniWarning } from '@freesewing/react/components/Mini'
export const MiniNoteExample = () => <MiniNote>I am a note, a mini note</MiniNote>
export const MiniTipExample = () => <MiniTip>I am a tip, a mini tip</MiniTip>
export const MiniWarningExample = () => <MiniWarning>I am a warning, a mini warning</MiniWarning>

View file

@ -2,6 +2,39 @@
title: Mini
---
:::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 * as jsdoc from '@site/prebuild/jsdoc/components.mini.mjs'
import {
MiniNoteExample,
MiniTipExample,
MiniWarningExample,
} from './_examples.js'
<DocusaurusDoc>
The __Mini__ component family provides the following components:
- [MiniNote](#mininote)
- [MiniTip](#minitip)
- [MiniWarning](#miniwarning)
:::tip
These components are typically used when a
[Popout](/reference/packages/react/components/popout/) would take up too much
space.
:::
## MiniNote
<ComponentDocs docs={jsdoc.jsdocMiniNote} example={MiniNoteExample} />
## MiniTip
<ComponentDocs docs={jsdoc.jsdocMiniTip} example={MiniTipExample} />
## MiniWarning
<ComponentDocs docs={jsdoc.jsdocMiniWarning} example={MiniWarningExample} />
</DocusaurusDoc>