From c1da74cbc0fafbe7aa1e4543aae60ef82067fc49 Mon Sep 17 00:00:00 2001 From: Keith Grant Date: Wed, 30 Oct 2019 15:06:42 -0700 Subject: [PATCH 1/2] fix PF switch styling --- .../src/components/NotificationList/NotificationListItem.jsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/awx/ui_next/src/components/NotificationList/NotificationListItem.jsx b/awx/ui_next/src/components/NotificationList/NotificationListItem.jsx index 43c51543d3..f32e8a80e7 100644 --- a/awx/ui_next/src/components/NotificationList/NotificationListItem.jsx +++ b/awx/ui_next/src/components/NotificationList/NotificationListItem.jsx @@ -27,6 +27,8 @@ const DataListCell = styled(PFDataListCell)` const Switch = styled(PFSwitch)` display: flex; flex-wrap: no-wrap; + /* workaround PF bug; used in calculating switch width: */ + --pf-c-switch__toggle-icon--Offset: 0.125rem; `; function NotificationListItem(props) { From 21f7ca21e055bab52de42f0b20738f7b6235d513 Mon Sep 17 00:00:00 2001 From: Keith Grant Date: Thu, 31 Oct 2019 11:34:37 -0700 Subject: [PATCH 2/2] refactor dupe code to new TemplateAddButton component --- .../NotificationListItem.test.jsx.snap | 36 ++++---- .../TemplateList/TemplateAddButton.jsx | 54 +++++++++++ .../TemplateList/TemplateAddButton.test.jsx | 25 +++++ .../Template/TemplateList/TemplateList.jsx | 91 +------------------ 4 files changed, 102 insertions(+), 104 deletions(-) create mode 100644 awx/ui_next/src/screens/Template/TemplateList/TemplateAddButton.jsx create mode 100644 awx/ui_next/src/screens/Template/TemplateList/TemplateAddButton.test.jsx diff --git a/awx/ui_next/src/components/NotificationList/__snapshots__/NotificationListItem.test.jsx.snap b/awx/ui_next/src/components/NotificationList/__snapshots__/NotificationListItem.test.jsx.snap index ee9f735fec..6b8d98afcc 100644 --- a/awx/ui_next/src/components/NotificationList/__snapshots__/NotificationListItem.test.jsx.snap +++ b/awx/ui_next/src/components/NotificationList/__snapshots__/NotificationListItem.test.jsx.snap @@ -331,9 +331,9 @@ exports[` initially renders succe "componentStyle": ComponentStyle { "componentId": "NotificationListItem__Switch-w674ng-1", "isStatic": true, - "lastClassName": "hbNxaH", + "lastClassName": "hfzRow", "rules": Array [ - "display:flex;flex-wrap:no-wrap;", + "display:flex;flex-wrap:no-wrap;--pf-c-switch__toggle-icon--Offset:0.125rem;", ], }, "displayName": "NotificationListItem__Switch", @@ -356,7 +356,7 @@ exports[` initially renders succe > initially renders succe componentProps={ Object { "aria-label": "Toggle notification start", - "className": "NotificationListItem__Switch-w674ng-1 hbNxaH", + "className": "NotificationListItem__Switch-w674ng-1 hfzRow", "id": "notification-9000-started-toggle", "isChecked": false, "isDisabled": false, @@ -382,7 +382,7 @@ exports[` initially renders succe > initially renders succe } >