From bf978a0bfca0a6ff97f9a1cc733750455d3443d6 Mon Sep 17 00:00:00 2001 From: Dmitriy Kovalskiy Date: Wed, 10 Jul 2019 23:46:54 +0300 Subject: [PATCH] Destination list height depends of search bar existence --- src/components/destination_list.js | 12 ++++++++---- src/components/with_search.js | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/components/destination_list.js b/src/components/destination_list.js index 5649f71..e5fba99 100644 --- a/src/components/destination_list.js +++ b/src/components/destination_list.js @@ -23,12 +23,14 @@ const DestinationList = ({ withGrouping, filteredItems, children, - isLocked + isLocked, + showSearch }) => { const SelectionStatusRenderer = selectionStatusRenderer; const updatedSelectedItems = withGrouping ? groupItems(filteredItems) : filteredItems; + const calculatedHeight = showSearch ? height - 90 : height - 45; return ( @@ -43,7 +45,7 @@ const DestinationList = ({ unselectItems([id])} renderer={selectedItemRenderer} noItemsRenderer={noItemsRenderer} @@ -67,7 +69,8 @@ DestinationList.propTypes = { withGrouping: PropTypes.bool, filteredItems: PropTypes.arrayOf(PropTypes.object), children: PropTypes.node, - isLocked: PropTypes.func + isLocked: PropTypes.func, + showSearch: PropTypes.bool }; DestinationList.defaultProps = { @@ -80,7 +83,8 @@ DestinationList.defaultProps = { selectedItemRenderer: SelectedItem, noItemsRenderer: NoItems, withGrouping: false, - filteredItems: [] + filteredItems: [], + showSearch: false }; export { DestinationList }; diff --git a/src/components/with_search.js b/src/components/with_search.js index 5071369..bc8e5af 100644 --- a/src/components/with_search.js +++ b/src/components/with_search.js @@ -12,7 +12,7 @@ const withSearch = WrappedComponent => ({ }) => { const SearchRenderer = searchRenderer; return ( - + {showSearch && (