From 8ced249c91745ed995021e1deba2c2b37bc0a648 Mon Sep 17 00:00:00 2001 From: Jack Westbrook Date: Thu, 27 May 2021 15:28:09 +0200 Subject: [PATCH] AddPanelWidget: Add padding to prevent top being cut off (#34806) * fix(dashboardpage): add padding so add panel chrome isnt cut off * fix(addpanelwidget): introduce wrapping element to cater for pulsate animation offset * refactor(addpanelwidget): use spacing.xs rather than spacing.sm * test(addpanelwidget): update snapshot --- .../AddPanelWidget/AddPanelWidget.tsx | 67 +++++++------ .../AddPanelWidget.test.tsx.snap | 93 ++++++++++--------- 2 files changed, 86 insertions(+), 74 deletions(-) diff --git a/public/app/features/dashboard/components/AddPanelWidget/AddPanelWidget.tsx b/public/app/features/dashboard/components/AddPanelWidget/AddPanelWidget.tsx index 23307b2843f..ff95990c30e 100644 --- a/public/app/features/dashboard/components/AddPanelWidget/AddPanelWidget.tsx +++ b/public/app/features/dashboard/components/AddPanelWidget/AddPanelWidget.tsx @@ -136,38 +136,40 @@ export const AddPanelWidgetUnconnected: React.FC = ({ panel, dashboard }) const copiedPanelPlugins = useMemo(() => getCopiedPanelPlugins(), []); return ( -
- - {addPanelView ? 'Add panel from panel library' : 'Add panel'} - - {addPanelView ? ( - - ) : ( -
-
-
onCreateNewPanel()} aria-label={selectors.pages.AddDashboard.addNewPanel}> - - Add an empty panel -
-
- - Add a new row -
-
-
-
setAddPanelView(true)}> - - Add a panel from the panel library -
- {copiedPanelPlugins.length === 1 && ( -
onPasteCopiedPanel(copiedPanelPlugins[0])}> - - Paste panel from clipboard +
+
+ + {addPanelView ? 'Add panel from panel library' : 'Add panel'} + + {addPanelView ? ( + + ) : ( +
+
+
onCreateNewPanel()} aria-label={selectors.pages.AddDashboard.addNewPanel}> + + Add an empty panel
- )} +
+ + Add a new row +
+
+
+
setAddPanelView(true)}> + + Add a panel from the panel library +
+ {copiedPanelPlugins.length === 1 && ( +
onPasteCopiedPanel(copiedPanelPlugins[0])}> + + Paste panel from clipboard +
+ )} +
-
- )} + )} +
); }; @@ -213,7 +215,12 @@ const getStyles = (theme: GrafanaTheme) => { `; return { + // wrapper is used to make sure box-shadow animation isn't cut off in dashboard page wrapper: css` + height: 100%; + padding-top: ${theme.spacing.xs}; + `, + callToAction: css` overflow: hidden; outline: 2px dotted transparent; outline-offset: 2px; diff --git a/public/app/features/dashboard/components/AddPanelWidget/__snapshots__/AddPanelWidget.test.tsx.snap b/public/app/features/dashboard/components/AddPanelWidget/__snapshots__/AddPanelWidget.test.tsx.snap index 2a129b3ffb2..91ce4bc4298 100644 --- a/public/app/features/dashboard/components/AddPanelWidget/__snapshots__/AddPanelWidget.test.tsx.snap +++ b/public/app/features/dashboard/components/AddPanelWidget/__snapshots__/AddPanelWidget.test.tsx.snap @@ -2,60 +2,65 @@ exports[`Render should render component 1`] = `
- - Add panel -
+ + Add panel +
- - Add an empty panel +
+ + Add an empty panel +
+
+ + Add a new row +
- - Add a new row -
-
-
-
- - Add a panel from the panel library +
+ + Add a panel from the panel library +