Radarr/frontend/src/Components/Form/FormInputButton.tsx
admin 1b42fe1e25 fix: mark React component props as Readonly
Bulk update to make all component props immutable at the type level.
This prevents accidental prop mutation and improves type safety.

Resolves ~50 SonarCloud code smells.
2025-12-18 15:31:40 -06:00

42 lines
1,016 B
TypeScript

import classNames from 'classnames';
import React from 'react';
import Button, { ButtonProps } from 'Components/Link/Button';
import SpinnerButton from 'Components/Link/SpinnerButton';
import { kinds } from 'Helpers/Props';
import styles from './FormInputButton.css';
export interface FormInputButtonProps extends ButtonProps {
canSpin?: boolean;
isLastButton?: boolean;
isSpinning?: boolean;
}
function FormInputButton({
className = styles.button,
canSpin = false,
isLastButton = true,
isSpinning = false,
kind = kinds.PRIMARY,
...otherProps
}: Readonly<FormInputButtonProps>) {
if (canSpin) {
return (
<SpinnerButton
className={classNames(className, !isLastButton && styles.middleButton)}
kind={kind}
isSpinning={isSpinning}
{...otherProps}
/>
);
}
return (
<Button
className={classNames(className, !isLastButton && styles.middleButton)}
kind={kind}
{...otherProps}
/>
);
}
export default FormInputButton;