2022-02-18 08:20:47 +00:00
|
|
|
import PropTypes from "prop-types";
|
2022-02-17 11:53:32 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Primary UI component for user interaction
|
|
|
|
*/
|
|
|
|
export const TextInputIcon = ({ icon, position, placeholder }) => {
|
|
|
|
return (
|
2022-02-18 08:20:47 +00:00
|
|
|
<div className={"flex flex-row items-center px-textInputIcon h-textInput rounded-full bg-palette-100"}>
|
|
|
|
{position === "left" ? <div className={"w-buttonIconLg h-buttonIconLg"}>{icon}</div> : null}
|
2022-02-17 11:53:32 +00:00
|
|
|
<input
|
|
|
|
placeholder={placeholder}
|
|
|
|
className={
|
2022-02-18 08:20:47 +00:00
|
|
|
"w-full focus:outline-none mx-textInputHorizontal rounded-full bg-transparent " +
|
|
|
|
"placeholder-palette-400 text-content tracking-inputPlaceholder text-textInput"
|
2022-02-17 11:53:32 +00:00
|
|
|
}
|
|
|
|
/>
|
2022-02-18 08:20:47 +00:00
|
|
|
{position === "right" ? <div className={"w-buttonIconLg h-buttonIconLg"}>{icon}</div> : null}
|
2022-02-17 11:53:32 +00:00
|
|
|
</div>
|
2022-02-18 08:20:47 +00:00
|
|
|
);
|
|
|
|
};
|
2022-02-17 11:53:32 +00:00
|
|
|
|
|
|
|
TextInputIcon.propTypes = {
|
|
|
|
/**
|
|
|
|
* Icon to place in text input
|
|
|
|
*/
|
|
|
|
icon: PropTypes.element,
|
|
|
|
/**
|
|
|
|
* Side to place icon
|
|
|
|
*/
|
2022-02-18 08:20:47 +00:00
|
|
|
position: PropTypes.oneOf(["left", "right"]),
|
2022-02-17 11:53:32 +00:00
|
|
|
/**
|
|
|
|
* Input placeholder
|
|
|
|
*/
|
|
|
|
placeholder: PropTypes.string,
|
2022-02-18 08:20:47 +00:00
|
|
|
};
|