[chore] fix some sonarcloud code smells

This commit is contained in:
MathieuG-P
2023-07-01 16:48:30 +02:00
parent 8a99c412fd
commit 7e261fcb93
23 changed files with 88 additions and 100 deletions
@@ -15,7 +15,7 @@ export function BsmCheckbox({className, checked, onChange, disabled} : Props) {
const handleClick = () => {
if(disabled){ return; }
onChange && onChange(!checked);
onChange?.(!checked);
}
return (
@@ -56,7 +56,7 @@ export function BsmRange({colorType = "first-color", values, onChange, onFinalCh
color: labelTextColor,
}}
>
{renderLabel && renderLabel(values[index])}
{renderLabel?.(values[index])}
</div>
)}
/>
@@ -19,7 +19,7 @@ export function BsmSelect<T = unknown>(props: Props<T>) {
return (
<select {...props} onChange={handleChange} defaultValue={props.options?.findIndex(opt => equal(opt.value, props.selected))}>
{props.options && props.options.map((option, index) => (
{props.options?.map((option, index) => (
<option key={JSON.stringify(option)} value={index}>{t(option.text)}</option>
))}
</select>