diff --git a/packages/grafana-ui/src/components/PanelChrome/PanelChrome.tsx b/packages/grafana-ui/src/components/PanelChrome/PanelChrome.tsx index 95b3780e9ef..90da9adfd77 100644 --- a/packages/grafana-ui/src/components/PanelChrome/PanelChrome.tsx +++ b/packages/grafana-ui/src/components/PanelChrome/PanelChrome.tsx @@ -153,7 +153,7 @@ export function PanelChrome({ cursor: dragClass ? 'move' : 'auto', }; - const containerStyles: CSSProperties = { width, height: !collapsed ? height : headerHeight }; + const containerStyles: CSSProperties = { width, height: collapsed ? undefined : height }; const [ref, { width: loadingBarWidth }] = useMeasure(); /** Old property name now maps to actions */ @@ -163,39 +163,39 @@ export function PanelChrome({ const testid = title ? selectors.components.Panels.Panel.title(title) : 'Panel'; - const collapsibleHeader = ( -
- -
- ); - const headerContent = ( <> - {collapsible - ? collapsibleHeader - : title && ( -
- {title} -
- )} + {/* Non collapsible title */} + {!collapsible && title && ( +
+ {title} +
+ )} + + {/* Collapsible title */} + {collapsible && ( +
+ +
+ )}
@@ -476,6 +476,8 @@ const getStyles = (theme: GrafanaTheme2) => { }), clearButtonStyles: css({ alignItems: 'center', + display: 'flex', + gap: theme.spacing(0.5), background: 'transparent', color: theme.colors.text.primary, border: 'none',