mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-10-22 19:34:22 +00:00
Co-authored-by: Alan Buscaglia <alanbuscaglia@MacBook-Pro.local> Co-authored-by: alejandrobailo <alejandrobailo94@gmail.com> Co-authored-by: César Arroba <cesar@prowler.com> Co-authored-by: Alejandro Bailo <59607668+alejandrobailo@users.noreply.github.com>
59 lines
1.3 KiB
TypeScript
59 lines
1.3 KiB
TypeScript
"use client";
|
|
|
|
import { Input } from "@heroui/input";
|
|
import React from "react";
|
|
|
|
interface CustomServerInputProps {
|
|
name: string;
|
|
label?: string;
|
|
labelPlacement?: "inside" | "outside";
|
|
variant?: "flat" | "bordered" | "underlined" | "faded";
|
|
type?: string;
|
|
placeholder?: string;
|
|
isRequired?: boolean;
|
|
isInvalid?: boolean;
|
|
errorMessage?: string;
|
|
value?: string;
|
|
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
}
|
|
|
|
/**
|
|
* Custom input component that is used to display a server input without useForm hook.
|
|
*/
|
|
export const CustomServerInput = ({
|
|
name,
|
|
type = "text",
|
|
label,
|
|
labelPlacement = "outside",
|
|
placeholder,
|
|
variant = "bordered",
|
|
isRequired = false,
|
|
isInvalid = false,
|
|
errorMessage,
|
|
value,
|
|
onChange,
|
|
}: CustomServerInputProps) => {
|
|
return (
|
|
<div className="flex flex-col">
|
|
<Input
|
|
id={name}
|
|
name={name}
|
|
type={type}
|
|
label={label}
|
|
labelPlacement={labelPlacement}
|
|
placeholder={placeholder}
|
|
variant={variant}
|
|
isRequired={isRequired}
|
|
isInvalid={isInvalid}
|
|
errorMessage={errorMessage}
|
|
value={value}
|
|
onChange={onChange}
|
|
classNames={{
|
|
label: "tracking-tight font-light !text-default-500 text-xs z-0!",
|
|
input: "text-default-500 text-small",
|
|
}}
|
|
/>
|
|
</div>
|
|
);
|
|
};
|