sendou.ink/app/components/Input.tsx
Kalle 6feb269193
Full tournament feature WIP (#1196)
* Layout initial

* Add FillRosterSection component

* Move tournaments to feature folder

* Refactor Button props

* SubmitButton

* Register action

* Identifier -> Id

* Invite link via nanoid

* Team info submit

* Enter tiebreaker map list UI

* Invite members to tournament team initial

* Show banner if joined a team not captain of

* Add back teams page

* Change team roster size color when good

* Delete tournament team member
2022-12-21 23:24:59 +02:00

60 lines
1.2 KiB
TypeScript

import clsx from "clsx";
export function Input({
name,
id,
className,
minLength,
maxLength,
required,
defaultValue,
leftAddon,
icon,
pattern,
list,
"data-cy": dataCy,
"aria-label": ariaLabel,
value,
placeholder,
onChange,
}: {
name?: string;
id?: string;
className?: string;
minLength?: number;
maxLength?: number;
required?: boolean;
defaultValue?: string;
leftAddon?: string;
icon?: React.ReactNode;
pattern?: string;
list?: string;
"data-cy"?: string;
"aria-label"?: string;
value?: string;
placeholder?: string;
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
}) {
return (
<div className={clsx("input-container", className)}>
{leftAddon ? <div className="input-addon">{leftAddon}</div> : null}
<input
name={name}
id={id}
minLength={minLength}
maxLength={maxLength}
defaultValue={defaultValue}
pattern={pattern}
list={list}
data-cy={dataCy}
value={value}
onChange={onChange}
aria-label={ariaLabel}
required={required}
placeholder={placeholder}
/>
{icon}
</div>
);
}