forked from pterodactyl/panel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInputField.tsx
More file actions
30 lines (25 loc) · 711 Bytes
/
InputField.tsx
File metadata and controls
30 lines (25 loc) · 711 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import React, { forwardRef } from 'react';
import classNames from 'classnames';
import styles from './styles.module.css';
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}
/>
));
const InputField = Object.assign(Component, { Variants: Variant });
export default InputField;