misc_pterodactyl-panel/resources/scripts/components/elements/inputs/InputField.tsx

31 lines
711 B
TypeScript
Raw Normal View History

import React, { forwardRef } from 'react';
import classNames from 'classnames';
import styles from './styles.module.css';
2022-07-02 21:24:24 +00:00
enum Variant {
Normal,
Snug,
Loose,
}
interface InputFieldProps extends React.ComponentProps<'input'> {
variant?: Variant;
}
const Component = forwardRef<HTMLInputElement, InputFieldProps>(({ className, variant, ...props }, ref) => (
<input
ref={ref}
className={classNames(
'form-input',
styles.text_input,
{ [styles.loose]: variant === Variant.Loose },
className
)}
{...props}
/>
));
2022-07-02 21:24:24 +00:00
const InputField = Object.assign(Component, { Variants: Variant });
export default InputField;