mirror of
https://github.com/Sonarr/Sonarr.git
synced 2026-04-20 21:54:58 -04:00
Convert Form Components to TypeScript
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user