1
0
Fork 0

[react] fix: Do not export local components

This commit is contained in:
joostdecock 2025-05-10 10:16:35 +02:00
parent 8f53b047a6
commit 0bbc7ef242
2 changed files with 14 additions and 9 deletions

View file

@ -63,9 +63,10 @@ const t = (input) => {
return input return input
} }
/* /**
* Component to show an individual measurements set * Component to show an individual measurements set
* *
* @component
* @param {object} props - All Component props * @param {object} props - All Component props
* @param {number} props.id - The ID of the measurements set to load * @param {number} props.id - The ID of the measurements set to load
* @param {bool} [props.publicOnly = false] - If the set should be used with the backend.getPublicSet method * @param {bool} [props.publicOnly = false] - If the set should be used with the backend.getPublicSet method
@ -384,7 +385,7 @@ export const Set = ({ id, publicOnly = false, Link = false, measurementHelpProvi
return ( return (
<div className="tw:w-full"> <div className="tw:w-full">
{heading} {heading}
<RenderedCSet {...{ mset, setLoadingStatus, backend, imperial }} /> <RenderedCset {...{ mset, setLoadingStatus, backend, imperial }} />
</div> </div>
) )
@ -619,28 +620,30 @@ export const Set = ({ id, publicOnly = false, Link = false, measurementHelpProvi
) )
} }
/** /*
* A (helper) component to display a measurements value * A (helper) component to display a measurements value
* *
* @component
* @param {object} props - All React props * @param {object} props - All React props
* @param {string} val - The value * @param {string} val - The value
* @param {string} m - The measurement name * @param {string} m - The measurement name
* @param {bool} imperial - True for imperial measurements, or metric by default * @param {bool} imperial - True for imperial measurements, or metric by default
*/ */
export const MeasurementValue = ({ val, m, imperial = false }) => const MeasurementValue = ({ val, m, imperial = false }) =>
isDegreeMeasurement(m) ? ( isDegreeMeasurement(m) ? (
<span>{val}°</span> <span>{val}°</span>
) : ( ) : (
<span dangerouslySetInnerHTML={{ __html: formatMm(val, imperial) }}></span> <span dangerouslySetInnerHTML={{ __html: formatMm(val, imperial) }}></span>
) )
/** /*
* React component to suggest a measurements set for curation * React component to suggest a measurements set for curation
* *
* @component
* @param {object} props - All React props * @param {object} props - All React props
* @param {string} mset - The measurements set * @param {string} mset - The measurements set
*/ */
export const SuggestCset = ({ mset, Link }) => { const SuggestCset = ({ mset, Link }) => {
// State // State
const [height, setHeight] = useState('') const [height, setHeight] = useState('')
const [img, setImg] = useState('') const [img, setImg] = useState('')
@ -760,13 +763,14 @@ export const SuggestCset = ({ mset, Link }) => {
) )
} }
/** /*
* React component to render a preview of a measurement set using the bonny pattern * React component to render a preview of a measurement set using the bonny pattern
* *
* @component
* @param {object} props - All React props * @param {object} props - All React props
* @param {string} mset - The measurements set * @param {string} mset - The measurements set
*/ */
export const RenderedCSet = ({ mset, imperial }) => { const RenderedCset = ({ mset, imperial }) => {
const [previewVisible, setPreviewVisible] = useState(false) const [previewVisible, setPreviewVisible] = useState(false)
const missing = [] const missing = []

View file

@ -29,7 +29,7 @@ import {
Reload as ReloadExample, Reload as ReloadExample,
Remove as RemoveExample, Remove as RemoveExample,
Restrict as RestrictExample, Restrict as RestrictExample,
Set as SetExample, Set,
Sets as SetsExample, Sets as SetsExample,
Tiktok as TiktokExample, Tiktok as TiktokExample,
Twitch as TwitchExample, Twitch as TwitchExample,
@ -89,6 +89,7 @@ const MsetCardExample = () => <MsetCard set={{ name: 'Example Set' }} />
const PatternExample = () => <Pattern id={1} /> const PatternExample = () => <Pattern id={1} />
const PatternCardExample = () => <PatternCard pattern={{ name: 'Example pattern' }} size="sm" /> const PatternCardExample = () => <PatternCard pattern={{ name: 'Example pattern' }} size="sm" />
const SetExample = () => <Set id={1} />
export { export {
AccountStatusExample, AccountStatusExample,