From 212d3d517d86507cf71b36689c4d47e0a0c02b77 Mon Sep 17 00:00:00 2001 From: Marliana Lara Date: Fri, 5 Apr 2019 15:39:14 -0400 Subject: [PATCH] Replace lookup with patternfly's input group component and 'fix' the height --- __tests__/components/Lookup.test.jsx | 4 ++-- src/app.scss | 14 +++--------- src/components/Lookup/Lookup.jsx | 34 ++++++++++++++++------------ 3 files changed, 25 insertions(+), 27 deletions(-) diff --git a/__tests__/components/Lookup.test.jsx b/__tests__/components/Lookup.test.jsx index dd75e29e3c..468793d8eb 100644 --- a/__tests__/components/Lookup.test.jsx +++ b/__tests__/components/Lookup.test.jsx @@ -62,7 +62,7 @@ describe('', () => { ).find('Lookup'); expect(spy).not.toHaveBeenCalled(); expect(wrapper.state('lookupSelectedItems')).toEqual(mockSelected); - const searchItem = wrapper.find('.pf-c-input-group__text#search'); + const searchItem = wrapper.find('button[aria-label="Search"]'); searchItem.first().simulate('click'); expect(spy).toHaveBeenCalled(); expect(wrapper.state('lookupSelectedItems')).toEqual([{ @@ -89,7 +89,7 @@ describe('', () => { ); setImmediate(() => { - const searchItem = wrapper.find('.pf-c-input-group__text#search'); + const searchItem = wrapper.find('button[aria-label="Search"]'); searchItem.first().simulate('click'); wrapper.find('input[type="checkbox"]').simulate('change'); expect(spy).toHaveBeenCalled(); diff --git a/src/app.scss b/src/app.scss index 1b4a0e45b3..b7ab178ded 100644 --- a/src/app.scss +++ b/src/app.scss @@ -132,12 +132,6 @@ } } -.pf-c-input-group__text { - &:hover { - cursor: pointer; - } -} - // // pf modal overrides // @@ -220,12 +214,10 @@ // note that these should be given a consistent prefix // and bem style, as well as moved into component-based scss files // -.awx-lookup { - min-height: 36px; - .pf-c-form-control { - --pf-c-form-control--Height: auto; - } +.awx-lookup .pf-c-form-control { + --pf-c-form-control--Height: 90px; + overflow-y: auto; } .awx-c-list { diff --git a/src/components/Lookup/Lookup.jsx b/src/components/Lookup/Lookup.jsx index c5a287a2b5..c65eee0935 100644 --- a/src/components/Lookup/Lookup.jsx +++ b/src/components/Lookup/Lookup.jsx @@ -2,12 +2,14 @@ import React, { Fragment } from 'react'; import PropTypes from 'prop-types'; import { SearchIcon, CubesIcon } from '@patternfly/react-icons'; import { - Chip, - Modal, Button, + ButtonVariant, + Chip, EmptyState, - EmptyStateIcon, EmptyStateBody, + EmptyStateIcon, + InputGroup, + Modal, Title } from '@patternfly/react-core'; import { I18n } from '@lingui/react'; @@ -172,16 +174,20 @@ class Lookup extends React.Component { return ( {({ i18n }) => ( -
- -
{chips}
+ + + +
+ {chips} +
+
error
: '' } - + )}
);