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

32 lines
737 B
TypeScript
Raw Normal View History

2022-11-25 20:25:03 +00:00
import { forwardRef } from 'react';
import * as React 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 },
2022-11-25 20:25:03 +00:00
className,
2022-07-02 21:24:24 +00:00
)}
{...props}
/>
));
2022-07-02 21:24:24 +00:00
const InputField = Object.assign(Component, { Variants: Variant });
export default InputField;