[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
|
@ -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}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue