mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-29 07:53:23 +00:00
chore: application prettier
This commit is contained in:
@ -1,13 +1,24 @@
|
||||
import React from 'react';
|
||||
|
||||
const CheckBox = ({ item, formData, handleChange, fieldName, itemLabelFunc = () => null, labelAttenuated = () => false, horizontal }) => {
|
||||
const CheckBox = ({
|
||||
item,
|
||||
formData,
|
||||
handleChange,
|
||||
fieldName,
|
||||
itemLabelFunc = () => null,
|
||||
labelAttenuated = () => false,
|
||||
horizontal,
|
||||
}) => {
|
||||
const isChecked = formData[fieldName].includes(parseInt(item.id));
|
||||
const isAttenuated = labelAttenuated(item) && !isChecked;
|
||||
return (
|
||||
<div key={item.id} className={`flex ${horizontal ? 'flex-col items-center' : 'flex-row items-center'}`}>
|
||||
<div
|
||||
key={item.id}
|
||||
className={`flex ${horizontal ? 'flex-col items-center' : 'flex-row items-center'}`}
|
||||
>
|
||||
{horizontal && (
|
||||
<label
|
||||
htmlFor={`${fieldName}-${item.id}`}
|
||||
<label
|
||||
htmlFor={`${fieldName}-${item.id}`}
|
||||
className={`block text-sm text-center mb-1 ${isAttenuated ? 'text-gray-300' : 'font-bold text-emerald-600'}`}
|
||||
>
|
||||
{itemLabelFunc(item)}
|
||||
@ -24,8 +35,8 @@ const CheckBox = ({ item, formData, handleChange, fieldName, itemLabelFunc = ()
|
||||
style={{ borderRadius: '6px', outline: 'none', boxShadow: 'none' }}
|
||||
/>
|
||||
{!horizontal && (
|
||||
<label
|
||||
htmlFor={`${fieldName}-${item.id}`}
|
||||
<label
|
||||
htmlFor={`${fieldName}-${item.id}`}
|
||||
className={`block text-sm ${isAttenuated ? 'text-gray-300' : 'font-bold text-emerald-600'}`}
|
||||
>
|
||||
{itemLabelFunc(item)}
|
||||
@ -35,4 +46,4 @@ const CheckBox = ({ item, formData, handleChange, fieldName, itemLabelFunc = ()
|
||||
);
|
||||
};
|
||||
|
||||
export default CheckBox;
|
||||
export default CheckBox;
|
||||
|
||||
Reference in New Issue
Block a user