mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-10-01 23:58:36 -05:00
Move app to apps/web-react in pnpm workspace layout
This commit is contained in:
86
apps/web-react/app/components/Input.tsx
Normal file
86
apps/web-react/app/components/Input.tsx
Normal file
@@ -0,0 +1,86 @@
|
||||
import clsx from "clsx";
|
||||
import styles from "./Input.module.css";
|
||||
|
||||
export function Input({
|
||||
name,
|
||||
id,
|
||||
className,
|
||||
minLength,
|
||||
maxLength,
|
||||
required,
|
||||
defaultValue,
|
||||
leftAddon,
|
||||
icon,
|
||||
type,
|
||||
min,
|
||||
max,
|
||||
pattern,
|
||||
list,
|
||||
testId,
|
||||
"aria-label": ariaLabel,
|
||||
value,
|
||||
placeholder,
|
||||
onChange,
|
||||
onKeyDown,
|
||||
disableAutoComplete = false,
|
||||
readOnly,
|
||||
ref,
|
||||
}: {
|
||||
name?: string;
|
||||
id?: string;
|
||||
className?: string;
|
||||
minLength?: number;
|
||||
maxLength?: number;
|
||||
required?: boolean;
|
||||
defaultValue?: string;
|
||||
leftAddon?: string;
|
||||
icon?: React.ReactNode;
|
||||
type?: "number" | "date";
|
||||
min?: number;
|
||||
max?: number | string;
|
||||
pattern?: string;
|
||||
list?: string;
|
||||
testId?: string;
|
||||
"aria-label"?: string;
|
||||
value?: string;
|
||||
placeholder?: string;
|
||||
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
||||
onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
||||
disableAutoComplete?: boolean;
|
||||
readOnly?: boolean;
|
||||
ref?: React.Ref<HTMLInputElement>;
|
||||
}) {
|
||||
return (
|
||||
<div
|
||||
className={clsx(styles.container, className, {
|
||||
[styles.readOnly]: readOnly,
|
||||
})}
|
||||
>
|
||||
{leftAddon ? <div className={styles.addon}>{leftAddon}</div> : null}
|
||||
<input
|
||||
ref={ref}
|
||||
className="in-container"
|
||||
name={name}
|
||||
id={id}
|
||||
minLength={minLength}
|
||||
maxLength={maxLength}
|
||||
min={min}
|
||||
max={max}
|
||||
defaultValue={defaultValue}
|
||||
pattern={pattern}
|
||||
list={list}
|
||||
data-testid={testId}
|
||||
value={value}
|
||||
onChange={onChange}
|
||||
onKeyDown={onKeyDown}
|
||||
aria-label={ariaLabel}
|
||||
required={required}
|
||||
placeholder={placeholder}
|
||||
type={type}
|
||||
autoComplete={disableAutoComplete ? "one-time-code" : undefined}
|
||||
readOnly={readOnly}
|
||||
/>
|
||||
{icon}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user