sendou.ink/app/components/Input.tsx
Kalle 30063f6075
VoDs (#1283)
* YouTube lite embed + CSS bundled import

* Migration initial

* New VoD page initial functioning

* Table changes + add TODOs

* New structure for add vod page

* WIP add new VoD backend

* Merge branch 'rewrite' of https://github.com/Sendouc/sendou.ink into vods

* Fix when leaderboard appears

* Function new vod form

* Single vod page initial

* Different YouTubeEmbed

* Scroll to top when going to timestamp

* Vod match weapon/mode icons

* Vod page user

* Add date to vod page

* Adjust migration order

* Vod page many weapons

* Add title to vod page

* New vods page cast many weapons

* Add player index to order by

* Vods new more validation

* Vod listing page initial

* Vods page with filters

* Show message if no vods

* Fix not being to unset filters

* Fix seed sometimes throwing errors

* User page VoDs

* Vods nullable weapon combobox

* Link directly to user custom url from vod page

* Make video adder admin action

* Can add video checks

* i18n

* New VoD form tests

* VoD operates filters test

* Vods behind flag

* Remove from config
2023-02-26 14:31:57 +02:00

69 lines
1.3 KiB
TypeScript

import clsx from "clsx";
export function Input({
name,
id,
className,
minLength,
maxLength,
required,
defaultValue,
leftAddon,
icon,
type,
min,
max,
pattern,
list,
testId,
"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;
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;
}) {
return (
<div className={clsx("input-container", className)}>
{leftAddon ? <div className="input-addon">{leftAddon}</div> : null}
<input
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}
aria-label={ariaLabel}
required={required}
placeholder={placeholder}
type={type}
/>
{icon}
</div>
);
}