Skip to content

Commit

Permalink
fix(ui): documente le composant <Button/> et donne un valeur par défa…
Browse files Browse the repository at this point in the history
…ut à 'type'
  • Loading branch information
thom4parisot authored and ggrossetie committed Dec 12, 2024
1 parent 88d5a91 commit d0e1de8
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion front/src/components/Field.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,33 @@ import clsx from 'clsx'
import React, { forwardRef, useId } from 'react'
import styles from './field.module.scss'

/**
* @typedef {Object} FieldInput
* @property {string} label
* @property {string=} type
* @property {string=} id
* @property {boolean=} hasError
* @property {string=} className
* @property {string=} prefix
* @property {React.ReactNode[]=} children
*/

/**
* @param {React.ReactHTMLElement(props: FieldInput)} node
* @param {React.ForwardedRef} forwardedRef
* @return {React.ForwardRefRenderFunction}
*/
export default forwardRef(function Field(
{ hasError, className, prefix, children, label, id, type, ...otherProps },
{
hasError,
className,
prefix,
children,
label,
id,
type = 'text',
...otherProps
},
forwardedRef
) {
const uid = `field-${id ?? useId()}`
Expand Down

0 comments on commit d0e1de8

Please sign in to comment.