This repository has been archived on 2022-10-07. You can view files and clone it, but cannot push or open issues or pull requests.
skynet-webportal/packages/dashboard-v2/src/components/TextInputIcon/TextInputIcon.js

36 lines
1019 B
JavaScript
Raw Normal View History

2022-02-18 08:20:47 +00:00
import PropTypes from "prop-types";
/**
* 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}
<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-18 08:20:47 +00:00
{position === "right" ? <div className={"w-buttonIconLg h-buttonIconLg"}>{icon}</div> : null}
</div>
2022-02-18 08:20:47 +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"]),
/**
* Input placeholder
*/
placeholder: PropTypes.string,
2022-02-18 08:20:47 +00:00
};