First Commit

This commit is contained in:
Fabian Stamm
2020-03-29 16:05:39 +02:00
commit 3f63c202f6
17 changed files with 498 additions and 0 deletions

81
src/Input.tsx Normal file
View File

@ -0,0 +1,81 @@
import { h, JSX } from "preact";
export function Input({
className,
children,
...props
}: JSX.HTMLAttributes<HTMLInputElement>) {
return (
<input className={"ht-inp " + className} {...props}>
{children}
</input>
);
}
export function TextArea({
className,
children,
...props
}: JSX.HTMLAttributes<HTMLTextAreaElement>) {
return (
<textarea className={"ht-inp " + className} {...props}>
{children}
</textarea>
);
}
export function InputGroup({
className,
children,
...props
}: JSX.HTMLAttributes<HTMLDivElement>) {
return (
<div className={"ht-input-group " + className} {...props}>
{children}
</div>
);
}
export interface IInputCheckboxProps {
label: string;
}
export function InputCheckbox({
label,
...props
}: IInputCheckboxProps & JSX.HTMLAttributes<HTMLInputElement>) {
return (
<label class="ht-input-checkbox">
{label}
<input type="checkbox" {...props} />
<span></span>
</label>
);
}
export interface IInputRadioProps {
label: string;
}
export function InputRadio({
label,
...props
}: IInputCheckboxProps & JSX.HTMLAttributes<HTMLInputElement>) {
return (
<label class="ht-input-checkbox">
{label}
<input type="radio" {...props} />
<span></span>
</label>
);
}
export function InputSelect({
className,
children,
...props
}: JSX.HTMLAttributes<HTMLSelectElement>) {
return (
<select className={"ht-inp " + className} {...props}>
{children}
</select>
);
}