Skip to content

Commit

Permalink
search and text field can get icons
Browse files Browse the repository at this point in the history
  • Loading branch information
orrgottlieb committed Mar 22, 2021
1 parent 720cd08 commit bb0c790
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 23 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "monday-ui-react-core",
"version": "0.0.109",
"version": "0.0.110",
"description": "Official monday.com UI resources for application development in React.js",
"main": "dist/main.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Icon/Icon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const Icon = forwardRef(
return null;
}

if (iconType === ICON_TYPES.SVG) {
if (iconType === ICON_TYPES.SVG || typeof icon === "function") {
const IconComponent = icon;
return (
<IconComponent
Expand Down
4 changes: 2 additions & 2 deletions src/components/Search/Search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ Search.sizes = SIZES;
Search.types = TYPES;

Search.propTypes = {
secondaryIconName: PropTypes.string,
iconName: PropTypes.string,
secondaryIconName: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
iconName: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
onChange: PropTypes.func,
autoFocus: PropTypes.bool,
underline: PropTypes.bool,
Expand Down
34 changes: 18 additions & 16 deletions src/components/Search/__stories__/search.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import SearchStoryLine from "./SearchStoryLine";
import { FlexLayout } from "../../storybook-helpers";
import Search from "../Search";
import { withPerformance } from "storybook-addon-performance";
import { CloseSmall } from "../../Icon/Icons";
import SearchIcon from "../../Icon/Icons/components/Search";

export const Sandbox = () => {
return (
Expand Down Expand Up @@ -43,8 +45,8 @@ export const Sizes = () => {
<Search
className=""
inputAriaLabel="Search for content"
iconName="fa-search"
secondaryIconName="fa-close"
iconName={SearchIcon}
secondaryIconName={CloseSmall}
id="size_1"
placeholder="Placeholder text goes here"
size={Search.sizes.SMALL}
Expand All @@ -58,8 +60,8 @@ export const Sizes = () => {
<Search
className=""
inputAriaLabel="Search for content"
iconName="fa-search"
secondaryIconName="fa-close"
iconName={SearchIcon}
secondaryIconName={CloseSmall}
id="size_2"
placeholder="Placeholder text goes here"
size={Search.sizes.MEDIUM}
Expand All @@ -73,8 +75,8 @@ export const Sizes = () => {
<Search
className=""
inputAriaLabel="Search for content"
iconName="fa-search"
secondaryIconName="fa-close"
iconName={SearchIcon}
secondaryIconName={CloseSmall}
id="size_3"
placeholder="Placeholder text goes here"
size={Search.sizes.LARGE}
Expand All @@ -95,8 +97,8 @@ export const States = () => {
<Search
className=""
inputAriaLabel="Search for content"
iconName="fa-search"
secondaryIconName="fa-close"
iconName={SearchIcon}
secondaryIconName={CloseSmall}
id="states_1"
placeholder="Placeholder text goes here"
size={Search.sizes.MEDIUM}
Expand All @@ -110,8 +112,8 @@ export const States = () => {
<Search
className="input-component__input--hover"
inputAriaLabel="Search for content"
iconName="fa-search"
secondaryIconName="fa-close"
iconName={SearchIcon}
secondaryIconName={CloseSmall}
id="states_1"
placeholder="Placeholder text goes here"
size={Search.sizes.MEDIUM}
Expand All @@ -124,8 +126,8 @@ export const States = () => {
<SearchStoryLine title="Filled">
<Search
inputAriaLabel="Search for content"
iconName="fa-search"
secondaryIconName="fa-close"
iconName={SearchIcon}
secondaryIconName={CloseSmall}
id="states_1"
placeholder="Placeholder text goes here"
size={Search.sizes.MEDIUM}
Expand All @@ -139,8 +141,8 @@ export const States = () => {
<Search
className="input-component__input--active"
inputAriaLabel="Search for content"
iconName="fa-search"
secondaryIconName="fa-close"
iconName={SearchIcon}
secondaryIconName={CloseSmall}
id="states_1"
placeholder="Placeholder text goes here"
size={Search.sizes.MEDIUM}
Expand All @@ -154,8 +156,8 @@ export const States = () => {
<Search
className="input-component__input--active"
inputAriaLabel="Search for content"
iconName="fa-search"
secondaryIconName="fa-close"
iconName={SearchIcon}
secondaryIconName={CloseSmall}
id="states_1"
placeholder="Placeholder text goes here"
size={Search.sizes.MEDIUM}
Expand Down
8 changes: 5 additions & 3 deletions src/components/TextField/TextField.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ const TextField = forwardRef(
iconLabel={iconsNames.primary}
iconType={Icon.type.ICON_FONT}
ignoreFocusStyle
iconSize={size === TextField.sizes.SMALL ? "16px" : "18px"}
/>
</div>
<div
Expand All @@ -171,6 +172,7 @@ const TextField = forwardRef(
iconLabel={iconsNames.secondary}
iconType={Icon.type.ICON_FONT}
ignoreFocusStyle
iconSize={size === TextField.sizes.SMALL ? "16px" : "18px"}
/>
</div>
</div>
Expand Down Expand Up @@ -213,8 +215,8 @@ TextField.propTypes = {
disabled: PropTypes.bool,
readonly: PropTypes.bool,
setRef: PropTypes.func,
iconName: PropTypes.string,
secondaryIconName: PropTypes.string,
iconName: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
secondaryIconName: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
id: PropTypes.string,
title: PropTypes.string,
/** SIZES is exposed on the component itself */
Expand All @@ -228,7 +230,7 @@ TextField.propTypes = {
wrapperClassName: PropTypes.string,
onIconClick: PropTypes.func,
clearOnIconClick: PropTypes.bool,
labelIconName: PropTypes.string,
labelIconName: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
showCharCount: PropTypes.bool,
inputAriaLabel: PropTypes.string,
/** Icon names labels for a11y */
Expand Down

0 comments on commit bb0c790

Please sign in to comment.