1
0
Fork 0

[react] feat: Added docs for components/Control

This commit is contained in:
joostdecock 2025-05-10 13:44:03 +02:00
parent 34ae1dc8dc
commit fc04e415c9
6 changed files with 35 additions and 8 deletions

View file

@ -2,9 +2,17 @@ import React from 'react'
import { controlDesc } from '@freesewing/config'
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 ? (
<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) => (
<BulletIcon
fill={control >= score ? true : false}