mirror of
https://github.com/Radarr/Radarr.git
synced 2026-03-29 18:15:37 -04:00
Co-authored-by: Mark McDowall <mark@mcdowall.ca> Remove defaultProps from TypeScript components (cherry picked from commit a90c13e86f798841cb6db038bb6b6d1408a00585) Fix multi-select checkboxes not appearing (cherry picked from commit e199710c15fbfa643a9f71c7a20f70b1722d0df6)
43 lines
858 B
TypeScript
43 lines
858 B
TypeScript
import classNames from 'classnames';
|
|
import React, { ReactNode } from 'react';
|
|
import { Size } from 'Helpers/Props/sizes';
|
|
import styles from './FormLabel.css';
|
|
|
|
interface FormLabelProps {
|
|
children: ReactNode;
|
|
className?: string;
|
|
errorClassName?: string;
|
|
size?: Extract<Size, keyof typeof styles>;
|
|
name?: string;
|
|
hasError?: boolean;
|
|
isAdvanced?: boolean;
|
|
}
|
|
|
|
function FormLabel(props: FormLabelProps) {
|
|
const {
|
|
children,
|
|
className = styles.label,
|
|
errorClassName = styles.hasError,
|
|
size = 'large',
|
|
name,
|
|
hasError,
|
|
isAdvanced = false,
|
|
} = props;
|
|
|
|
return (
|
|
<label
|
|
className={classNames(
|
|
className,
|
|
styles[size],
|
|
hasError && errorClassName,
|
|
isAdvanced && styles.isAdvanced
|
|
)}
|
|
htmlFor={name}
|
|
>
|
|
{children}
|
|
</label>
|
|
);
|
|
}
|
|
|
|
export default FormLabel;
|