31 lines
901 B
TypeScript
31 lines
901 B
TypeScript
import { ChangeEvent, ReactNode } from "react";
|
|
import { ComponentPropsWithoutRef } from "react";
|
|
|
|
interface TextfieldProps extends ComponentPropsWithoutRef<"input"> {}
|
|
|
|
function Textfield({value, onChange, placeholder}: TextfieldProps) {
|
|
return (
|
|
<input
|
|
className="w-full border border-neutral-700 rounded-lg px-4 py-2.5 placeholder-neutral-500 focus:outline-none focus:border-blue-400 text-sm"
|
|
value={value}
|
|
onChange={onChange}
|
|
placeholder={placeholder}
|
|
/>
|
|
)
|
|
}
|
|
|
|
function Dropdown({ children, ...props }: ComponentPropsWithoutRef<"select">) {
|
|
return (
|
|
<select
|
|
className="w-full border border-neutral-700 rounded-lg px-3 py-2 focus:outline-none focus:border-blue-400 text-sm h-[38px]"
|
|
{...props}
|
|
>
|
|
{children}
|
|
</select>
|
|
);
|
|
}
|
|
|
|
export const Input = {
|
|
Text: Textfield,
|
|
Select: Dropdown,
|
|
}; |