From 64d4b71ec960495f59c82acf5dc2e4ef641b617c Mon Sep 17 00:00:00 2001 From: Alex Corey Date: Mon, 29 Apr 2019 10:41:57 -0400 Subject: [PATCH] UX improvements --- __tests__/components/DataListToolbar.test.jsx | 42 ++++++++++++------- src/components/AddRole/styles.scss | 1 + .../DataListToolbar/DataListToolbar.jsx | 26 +++++++----- src/components/DataListToolbar/styles.scss | 27 ++++++++---- .../DeleteRoleConfirmationModal.jsx | 2 +- 5 files changed, 66 insertions(+), 32 deletions(-) diff --git a/__tests__/components/DataListToolbar.test.jsx b/__tests__/components/DataListToolbar.test.jsx index a7ad38cca7..38959ff1e8 100644 --- a/__tests__/components/DataListToolbar.test.jsx +++ b/__tests__/components/DataListToolbar.test.jsx @@ -211,29 +211,43 @@ describe('', () => { const columns = [{ name: 'Name', key: 'name', isSortable: true }]; const onOpenDeleteModal = jest.fn(); const openDeleteModalButton = 'button[aria-label="Delete"]'; - const onSearch = jest.fn(); - const onSort = jest.fn(); - const onSelectAll = jest.fn(); - const showDelete = true; - const disableTrashCanIcon = false; toolbar = mountWithContexts( [1, 2, 3, 4]} - sortedColumnKey="name" - sortOrder="ascending" columns={columns} - onSearch={onSearch} - onSort={onSort} - onSelectAll={onSelectAll} onOpenDeleteModal={onOpenDeleteModal} - showDelete={showDelete} - disableTrashCanIcon={disableTrashCanIcon} + showDelete /> ); toolbar.find(openDeleteModalButton).simulate('click'); expect(onOpenDeleteModal).toBeCalled(); }); + + test('Tooltip says "Select a row to delete" when trash can icon is disabled', () => { + toolbar = mountWithContexts( + + ); + + const toolTip = toolbar.find('.pf-c-tooltip__content'); + toolTip.simulate('mouseover'); + expect(toolTip.text()).toBe('Select a row to delete'); + }); + + test('Delete Org tooltip says "Delete" when trash can icon is enabled', () => { + toolbar = mountWithContexts( + + ); + const toolTip = toolbar.find('.pf-c-tooltip__content'); + toolTip.simulate('mouseover'); + expect(toolTip.text()).toBe('Delete'); + }); }); diff --git a/src/components/AddRole/styles.scss b/src/components/AddRole/styles.scss index 1abb3be18c..be64435e98 100644 --- a/src/components/AddRole/styles.scss +++ b/src/components/AddRole/styles.scss @@ -16,6 +16,7 @@ flex: 1; align-items: center; padding: 20px; + cursor: pointer; } } diff --git a/src/components/DataListToolbar/DataListToolbar.jsx b/src/components/DataListToolbar/DataListToolbar.jsx index 3d8992c69f..fd62b52b61 100644 --- a/src/components/DataListToolbar/DataListToolbar.jsx +++ b/src/components/DataListToolbar/DataListToolbar.jsx @@ -114,12 +114,14 @@ class DataListToolbar extends React.Component { { showDelete && ( - +
- +
)} {showAdd && addUrl && ( - + + )} {showAdd && add && ( diff --git a/src/components/DataListToolbar/styles.scss b/src/components/DataListToolbar/styles.scss index b05068218f..8a29cef8f1 100644 --- a/src/components/DataListToolbar/styles.scss +++ b/src/components/DataListToolbar/styles.scss @@ -76,18 +76,18 @@ margin-right: 20px; } -.awx-toolbar .pf-c-button { - margin-right: 20px; -} - .awx-toolbar .pf-l-toolbar__item .pf-c-button.pf-m-plain { font-size: 18px; } -.pf-c-button--disabled--BackgroundColor{ - background-color: #b7b7b7; -} + .awx-ToolBarBtn{ width: 30px; + position: absolute; + right: 80px; + display: flex; + justify-content: center; + margin-right: 20px; + border-radius: 3px; } .awx-ToolBarBtn:hover{ .awx-ToolBarTrashCanIcon { @@ -95,4 +95,17 @@ } background-color:#d9534f; } +.awx-ToolBarTrashCanIcon-disabled{ + width: 30px; + position: absolute; + right: 80px; + display: flex; + justify-content: center; + margin-right: 20px; +} +.pf-l-toolbar >div{ + &:last-child{ + display:none; + } +} diff --git a/src/pages/Organizations/components/DeleteRoleConfirmationModal.jsx b/src/pages/Organizations/components/DeleteRoleConfirmationModal.jsx index 6a6d324710..4f4760b864 100644 --- a/src/pages/Organizations/components/DeleteRoleConfirmationModal.jsx +++ b/src/pages/Organizations/components/DeleteRoleConfirmationModal.jsx @@ -33,7 +33,7 @@ class DeleteRoleConfirmationModal extends React.Component { variant="danger" title={i18nMark(title)} isOpen - onClose={this.hideWarning} + onClose={onCancel} actions={[