mirror of
https://github.com/Radarr/Radarr
synced 2026-01-26 17:33:13 +01:00
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.
42 lines
1,016 B
TypeScript
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;
|