input field update rest syntax

This commit is contained in:
BFlat committed 2023-08-10 10:32:00 +07:00
1 parent 4b4c152d6e
commit b3a9a4307a
1 file changed
+23
@@ -0,0 +1,23 @@
import React from "react";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { IconDefinition } from "@fortawesome/fontawesome-svg-core";
interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
icon?: IconDefinition;
label?: string;
}
export default function Input({ label, icon, ...rest }: InputProps) {
return (
<div>
{label && <label className="sub-title">{label}</label>}
<div className={`form-group ${icon ? "input-icon" : ""}`}>
{icon && (
<FontAwesomeIcon icon={icon} className="form-control-feedback" />
)}
<input className="form-control" {...rest} />
</div>
</div>
);
}