diff --git a/packages/grafana-ui/src/components/PageLayout/PageToolbar.tsx b/packages/grafana-ui/src/components/PageLayout/PageToolbar.tsx index afbb5853087..96e2d60356e 100644 --- a/packages/grafana-ui/src/components/PageLayout/PageToolbar.tsx +++ b/packages/grafana-ui/src/components/PageLayout/PageToolbar.tsx @@ -54,45 +54,42 @@ export const PageToolbar: FC = React.memo( return (
-
- {pageIcon && !onGoBack && ( -
- -
- )} - {onGoBack && ( -
- -
- )} -
- {parent && onClickParent && ( - - )} - {onClickTitle && ( - - )} - {!onClickTitle &&
{title}
} + {pageIcon && !onGoBack && ( +
+
- {leftItems?.map((child, index) => ( -
- {child} -
- ))} -
-
+ )} + {onGoBack && ( +
+ +
+ )} + {parent && onClickParent && ( + + )} + {onClickTitle && ( + + )} + {!onClickTitle &&
{title}
} + {leftItems?.map((child, index) => ( +
+ {child} +
+ ))} + +
{React.Children.toArray(children) .filter(Boolean) .map((child, index) => { @@ -114,7 +111,7 @@ const getStyles = (theme: GrafanaTheme2) => { const titleStyles = ` font-size: ${typography.size.lg}; - padding-left: ${spacing(1)}; + padding: ${spacing(0.5, 1, 0.5, 1)}; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; @@ -131,71 +128,51 @@ const getStyles = (theme: GrafanaTheme2) => { return { toolbar: css` - display: flex; + align-items: center; background: ${theme.colors.background.canvas}; - justify-content: flex-end; - flex-wrap: wrap; - padding: ${theme.spacing(1, 2, 0, 2)}; - `, - toolbarLeft: css` display: flex; - flex-grow: 1; - min-width: 0; + flex-wrap: wrap; + justify-content: flex-end; + padding: ${theme.spacing(1.5, 2)}; `, spacer: css` flex-grow: 1; `, pageIcon: css` - padding-top: ${spacing(1)}; - align-items: center; display: none; - @media ${styleMixins.mediaUp(theme.v1.breakpoints.md)} { display: flex; + align-items: center; } `, titleWrapper: css` display: flex; align-items: center; - padding-top: ${spacing(1)}; - padding-right: ${spacing(1)}; min-width: 0; overflow: hidden; `, - goBackButton: css` - position: relative; - top: 8px; - `, parentIcon: css` - margin-left: 4px; + margin-left: ${theme.spacing(0.5)}; `, titleText: css` ${titleStyles}; `, - titleLink: css` - ${titleStyles}; - `, parentLink: css` display: none; - + padding-right: 0; @media ${styleMixins.mediaUp(theme.v1.breakpoints.md)} { - display: inline-block; + display: unset; } `, actionWrapper: css` - padding-left: ${spacing(1)}; - padding-top: ${spacing(1)}; + padding: ${spacing(0.5, 0, 0.5, 1)}; `, leftActionItem: css` display: none; - height: 40px; - position: relative; - top: 5px; - align-items: center; - padding-left: ${spacing(0.5)}; - @media ${styleMixins.mediaUp(theme.v1.breakpoints.md)} { + align-items: center; display: flex; + padding-left: ${spacing(0.5)}; } `, }; diff --git a/public/app/features/alerting/unified/components/rule-editor/AlertRuleForm.tsx b/public/app/features/alerting/unified/components/rule-editor/AlertRuleForm.tsx index d90e6564e65..ab652aae7eb 100644 --- a/public/app/features/alerting/unified/components/rule-editor/AlertRuleForm.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/AlertRuleForm.tsx @@ -151,7 +151,7 @@ const getStyles = (theme: GrafanaTheme2) => { background: ${theme.colors.background.primary}; border: 1px solid ${theme.colors.border.weak}; border-radius: ${theme.shape.borderRadius()}; - margin: ${theme.spacing(2)}; + margin: ${theme.spacing(0, 2, 2)}; overflow: hidden; flex: 1; `, diff --git a/public/app/features/dashboard/components/DashboardSettings/DashboardSettings.tsx b/public/app/features/dashboard/components/DashboardSettings/DashboardSettings.tsx index d5dc2a382dc..33693fa2bdc 100644 --- a/public/app/features/dashboard/components/DashboardSettings/DashboardSettings.tsx +++ b/public/app/features/dashboard/components/DashboardSettings/DashboardSettings.tsx @@ -185,7 +185,7 @@ const getStyles = stylesFactory((theme: GrafanaTheme2) => ({ display: flex; `, settingsWrapper: css` - margin: ${theme.spacing(2)}; + margin: ${theme.spacing(0, 2, 2)}; display: flex; flex-grow: 1; `, diff --git a/public/app/features/dashboard/components/PanelEditor/OptionsPane.tsx b/public/app/features/dashboard/components/PanelEditor/OptionsPane.tsx index c10c4ef6f01..e6840e97450 100644 --- a/public/app/features/dashboard/components/PanelEditor/OptionsPane.tsx +++ b/public/app/features/dashboard/components/PanelEditor/OptionsPane.tsx @@ -67,7 +67,7 @@ const getStyles = (theme: GrafanaTheme) => { display: flex; flex: 1 1 0; flex-direction: column; - padding: ${theme.spacing.md} 0 0 0; + padding: 0; `, optionsWrapper: css` flex-grow: 1; diff --git a/public/app/features/dashboard/components/PanelEditor/PanelEditor.tsx b/public/app/features/dashboard/components/PanelEditor/PanelEditor.tsx index 1787ff5db20..c6685d5e09a 100644 --- a/public/app/features/dashboard/components/PanelEditor/PanelEditor.tsx +++ b/public/app/features/dashboard/components/PanelEditor/PanelEditor.tsx @@ -526,7 +526,7 @@ export const getStyles = stylesFactory((theme: GrafanaTheme, props: Props) => { `, panelToolbar: css` display: flex; - padding: ${paneSpacing} 0 ${paneSpacing} ${paneSpacing}; + padding: 0 0 ${paneSpacing} ${paneSpacing}; justify-content: space-between; flex-wrap: wrap; `, diff --git a/public/app/features/dashboard/containers/DashboardPage.tsx b/public/app/features/dashboard/containers/DashboardPage.tsx index cf71804f686..0a9cdb8e151 100644 --- a/public/app/features/dashboard/containers/DashboardPage.tsx +++ b/public/app/features/dashboard/containers/DashboardPage.tsx @@ -290,7 +290,8 @@ export class UnthemedDashboardPage extends PureComponent { render() { const { dashboard, isInitSlow, initError, isPanelEditorOpen, queryParams, theme } = this.props; const { editPanel, viewPanel, scrollTop, updateScrollTop } = this.state; - const styles = getStyles(theme); + const kioskMode = getKioskMode(queryParams.kiosk); + const styles = getStyles(theme, kioskMode); if (!dashboard) { if (isInitSlow) { @@ -303,7 +304,6 @@ export class UnthemedDashboardPage extends PureComponent { // Only trigger render when the scroll has moved by 25 const approximateScrollTop = Math.round(scrollTop / 25) * 25; const inspectPanel = this.getInspectPanel(); - const kioskMode = getKioskMode(queryParams.kiosk); return (
@@ -373,7 +373,8 @@ const mapDispatchToProps = { /* * Styles */ -export const getStyles = stylesFactory((theme: GrafanaTheme2) => { +export const getStyles = stylesFactory((theme: GrafanaTheme2, kioskMode) => { + const contentPadding = kioskMode !== KioskMode.Full ? theme.spacing(0, 2, 2) : theme.spacing(2); return { dashboardContainer: css` position: absolute; @@ -392,7 +393,7 @@ export const getStyles = stylesFactory((theme: GrafanaTheme2) => { display: flex; `, dashboardContent: css` - padding: ${theme.spacing(2)}; + padding: ${contentPadding}; flex-basis: 100%; flex-grow: 1; `, diff --git a/public/app/features/dashboard/containers/__snapshots__/DashboardPage.test.tsx.snap b/public/app/features/dashboard/containers/__snapshots__/DashboardPage.test.tsx.snap index 73324d76280..1d1555c2560 100644 --- a/public/app/features/dashboard/containers/__snapshots__/DashboardPage.test.tsx.snap +++ b/public/app/features/dashboard/containers/__snapshots__/DashboardPage.test.tsx.snap @@ -128,7 +128,7 @@ exports[`DashboardPage Dashboard init completed Should render dashboard grid 1` updateAfterMountMs={500} >
= ({ navModel }) => {