diff --git a/packages/pebble-web/src/components/OptionGroupCheckBox.tsx b/packages/pebble-web/src/components/OptionGroupCheckBox.tsx index 7796fb72..94092d8b 100644 --- a/packages/pebble-web/src/components/OptionGroupCheckBox.tsx +++ b/packages/pebble-web/src/components/OptionGroupCheckBox.tsx @@ -59,8 +59,14 @@ export default class OptionGroupCheckBox< clearVisible: this.clearVisible, ...this.props.advancedOptionsProps }; + + const isSearchMessagePresent = !!rest.searchBoxProps?.message; + const _optionGroupCheckboxWrap = isSearchMessagePresent + ? styles.optionGroupCheckBoxWrapWithMessage + : styles.optionGroupCheckBoxWrap; + return ( -
+
{...rest} advancedOptionsProps={advancedOptionsProps} diff --git a/packages/pebble-web/src/components/Search.tsx b/packages/pebble-web/src/components/Search.tsx index 76600bff..4c1fde79 100644 --- a/packages/pebble-web/src/components/Search.tsx +++ b/packages/pebble-web/src/components/Search.tsx @@ -4,10 +4,12 @@ import { SearchProps } from "./typings/Search"; import { searchStyle, searchWrapperStyle, - clearContainer + clearContainer, + searchMessageColor } from "./styles/Search.styles"; import Loader from "./Loader"; import { colors } from "pebble-shared"; +import { messageStyle } from "./styles/Input.styles"; class Search extends React.PureComponent { searchInputRef: React.RefObject = React.createRef(); @@ -27,48 +29,55 @@ class Search extends React.PureComponent { className, clearable, value, - loading + loading, + message, + wrapperClassName } = this.props; - const wrapperClassName = cx(searchWrapperStyle, { + const _searchBoxWrapperClassName = cx(searchWrapperStyle, { __pebble__search__small: type === "small", __pebble__search__large: type === "large", __pebble__search__table: type === "table" }); return ( -
- {type !== "large" && showSearchIcon && } - ) => { - onChange(e.target.value); - }} - ref={this.searchInputRef} - value={value} - {...inputProps} - /> - {loading && } - {clearable && ( -
{ - if (this.searchInputRef.current) { - this.searchInputRef.current.value = ""; - } - onChange(""); +
+
+ {type !== "large" && showSearchIcon && } + ) => { + onChange(e.target.value); }} - > - -
+ ref={this.searchInputRef} + value={value} + {...inputProps} + /> + {loading && } + {clearable && ( +
{ + if (this.searchInputRef.current) { + this.searchInputRef.current.value = ""; + } + onChange(""); + }} + > + +
+ )} +
+ {message && ( +
{message}
)}
); diff --git a/packages/pebble-web/src/components/shared/OptionGroup.tsx b/packages/pebble-web/src/components/shared/OptionGroup.tsx index d8bea53e..d9510ae4 100644 --- a/packages/pebble-web/src/components/shared/OptionGroup.tsx +++ b/packages/pebble-web/src/components/shared/OptionGroup.tsx @@ -8,8 +8,9 @@ import Search from "../Search"; import { searchBoxScrolledStyle, searchBoxWrapper, + searchBoxHeight, optionsWrapper, - searchBoxHeight + searchBoxHeightWithMessage } from "../styles/OptionGroup.styles"; import { rowWrapper, advancedActionsWrapper } from "../styles/Options.styles"; @@ -124,6 +125,7 @@ class OptionGroup extends React.PureComponent< searchBoxProps } = this.props; const { isScrolled, highlighted } = this.state; + const isMessagePresent = !!searchBoxProps?.message; const _children = React.Children.map(children, (_option, i) => { // `_option as React.ReactElement` is a hack @@ -175,7 +177,11 @@ class OptionGroup extends React.PureComponent<
; loading?: boolean; + message?: string; + wrapperClassName?: string; } diff --git a/packages/pebble-web/stories/search.story.tsx b/packages/pebble-web/stories/search.story.tsx index 738be094..073bee94 100644 --- a/packages/pebble-web/stories/search.story.tsx +++ b/packages/pebble-web/stories/search.story.tsx @@ -26,6 +26,7 @@ storiesOf("Components/Search", module).add( clearable={boolean("showClearButton", true)} value={store.state.query} loading={boolean("showLoading", false)} + message={text("message", "Search Message ")} /> )) );