Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | import React, { ReactNode } from "react";
import HandleInputRender, {
HandleInputRenderType,
} from "./HandleInputRender.tsx";
import { LabelPosition } from "../../types/inputs/labelPosition.ts";
import * as InputUtils from "./utils/index.ts";
type CustomInputPropTypes = {
suffix?: ReactNode;
labelPosition?: LabelPosition;
containerClassName?: string;
helpTextSide?: string;
} & HandleInputRenderType;
function CustomInput({
labelPosition = LabelPosition.TOP,
containerClassName = "",
helpTextSide,
...props
}: CustomInputPropTypes) {
return (
<div
className={`${InputUtils.handleLabelPositionClassname(
labelPosition,
)} ${InputUtils.handleInputTypeClassname(
props.inputType,
)} ${containerClassName} gap-1 w-fit`}>
{props.label && (
<p className="text-xs text-gray-500">
<b>{props.label}</b>
</p>
)}
<div className="flex items-center gap-1">
<HandleInputRender {...props} />
{props.suffix}
</div>
{helpTextSide && (
<p className="text-xs text-gray-500 italic">{helpTextSide}</p>
)}
</div>
);
}
export default CustomInput;
|