diff --git a/public/app/core/components/AppChrome/MegaMenu/MegaMenuHeader.tsx b/public/app/core/components/AppChrome/MegaMenu/MegaMenuHeader.tsx index cfce7392d31..8d60cb8c904 100644 --- a/public/app/core/components/AppChrome/MegaMenu/MegaMenuHeader.tsx +++ b/public/app/core/components/AppChrome/MegaMenu/MegaMenuHeader.tsx @@ -23,7 +23,7 @@ export function MegaMenuHeader({ handleMegaMenu, handleDockedMenu, onClose }: Pr return (
- + @@ -69,7 +69,7 @@ const getStyles = (theme: GrafanaTheme2) => ({ display: 'flex', gap: theme.spacing(1), justifyContent: 'space-between', - padding: theme.spacing(0, 1, 0, 0.5), + padding: theme.spacing(0, 1, 0, 0.75), height: TOP_BAR_LEVEL_HEIGHT, minHeight: TOP_BAR_LEVEL_HEIGHT, }), diff --git a/public/app/core/components/AppChrome/MegaMenu/MegaMenuItem.tsx b/public/app/core/components/AppChrome/MegaMenu/MegaMenuItem.tsx index 3640ff5fed9..d1e79208566 100644 --- a/public/app/core/components/AppChrome/MegaMenu/MegaMenuItem.tsx +++ b/public/app/core/components/AppChrome/MegaMenu/MegaMenuItem.tsx @@ -5,6 +5,7 @@ import { useLocation } from 'react-router-dom-v5-compat'; import { useLocalStorage } from 'react-use'; import { GrafanaTheme2, NavModelItem, toIconName } from '@grafana/data'; +import { config } from '@grafana/runtime'; import { useStyles2, Text, IconButton, Icon, Stack } from '@grafana/ui'; import { useGrafana } from 'app/core/context/GrafanaContext'; @@ -39,6 +40,7 @@ export function MegaMenuItem({ link, activeItem, level = 0, onClick, onPin, isPi ); const showExpandButton = level < MAX_DEPTH && Boolean(linkHasChildren(link) || link.emptyMessage); const item = useRef(null); + const isSingleTopNav = config.featureToggles.singleTopNav; const styles = useStyles2(getStyles); @@ -74,6 +76,29 @@ export function MegaMenuItem({ link, activeItem, level = 0, onClick, onPin, isPi ); } + function getIconName(isExpanded: boolean) { + if (isSingleTopNav) { + return isExpanded ? 'angle-up' : 'angle-down'; + } else { + return isExpanded ? 'angle-down' : 'angle-right'; + } + } + + const collapseIcon = ( +
+ {showExpandButton && ( + setSectionExpanded(!sectionExpanded)} + name={getIconName(Boolean(sectionExpanded))} + size="md" + variant="secondary" + /> + )} +
+ ); + return (
  • {level !== 0 && } {level === MAX_DEPTH &&
    } -
    - {showExpandButton && ( - setSectionExpanded(!sectionExpanded)} - name={sectionExpanded ? 'angle-down' : 'angle-right'} - size="md" - variant="secondary" - /> - )} -
    + {!isSingleTopNav && collapseIcon}
    + {isSingleTopNav && collapseIcon}
    {showExpandButton && sectionExpanded && (
      diff --git a/public/app/core/components/AppChrome/OrganizationSwitcher/OrganizationSwitcher.tsx b/public/app/core/components/AppChrome/OrganizationSwitcher/OrganizationSwitcher.tsx index d9d75fb0b46..1fbcd63ca39 100644 --- a/public/app/core/components/AppChrome/OrganizationSwitcher/OrganizationSwitcher.tsx +++ b/public/app/core/components/AppChrome/OrganizationSwitcher/OrganizationSwitcher.tsx @@ -1,8 +1,9 @@ +import { css } from '@emotion/css'; import { useEffect, useState } from 'react'; -import { SelectableValue } from '@grafana/data'; +import { GrafanaTheme2, SelectableValue } from '@grafana/data'; import { config, locationService } from '@grafana/runtime'; -import { Text, useTheme2 } from '@grafana/ui'; +import { Text, useStyles2, useTheme2 } from '@grafana/ui'; import { useMediaQueryChange } from 'app/core/hooks/useMediaQueryChange'; import { contextSrv } from 'app/core/services/context_srv'; import { getUserOrganizations, setUserOrganization } from 'app/features/org/state/actions'; @@ -17,6 +18,7 @@ export function OrganizationSwitcher() { const theme = useTheme2(); const dispatch = useDispatch(); const orgs = useSelector((state) => state.organization.userOrgs); + const styles = useStyles2(getStyles); const onSelectChange = (option: SelectableValue) => { if (option.value) { setUserOrganization(option.value.orgId); @@ -46,7 +48,11 @@ export function OrganizationSwitcher() { if (orgs?.length <= 1) { if (config.featureToggles.singleTopNav) { - return {Branding.AppTitle}; + return ( + + {Branding.AppTitle} + + ); } else { return null; } @@ -56,3 +62,9 @@ export function OrganizationSwitcher() { return ; } + +const getStyles = (theme: GrafanaTheme2) => ({ + brandTitle: css({ + paddingLeft: theme.spacing(1), + }), +}); diff --git a/public/app/core/components/AppChrome/TopBar/SingleTopBar.tsx b/public/app/core/components/AppChrome/TopBar/SingleTopBar.tsx index 40db95e4000..de93562e32e 100644 --- a/public/app/core/components/AppChrome/TopBar/SingleTopBar.tsx +++ b/public/app/core/components/AppChrome/TopBar/SingleTopBar.tsx @@ -96,7 +96,7 @@ const getStyles = (theme: GrafanaTheme2, menuDockedAndOpen: boolean) => ({ gap: theme.spacing(1), alignItems: 'center', padding: theme.spacing(0, 1), - paddingLeft: menuDockedAndOpen ? theme.spacing(3.5) : theme.spacing(0.5), + paddingLeft: menuDockedAndOpen ? theme.spacing(3.5) : theme.spacing(0.75), borderBottom: `1px solid ${theme.colors.border.weak}`, justifyContent: 'space-between',