diff --git a/packages/grafana-data/src/themes/createComponents.ts b/packages/grafana-data/src/themes/createComponents.ts index b9a7c60fc5e..8398d85a72e 100644 --- a/packages/grafana-data/src/themes/createComponents.ts +++ b/packages/grafana-data/src/themes/createComponents.ts @@ -80,7 +80,7 @@ export function createComponents(colors: ThemeColors, shadows: ThemeShadows): Th background: colors.mode === 'dark' ? 'rgba(0, 0, 0, 0.45)' : 'rgba(208, 209, 211, 0.24)', }, sidemenu: { - width: 60, + width: 44, }, }; } diff --git a/public/app/core/components/NavBar/BottomSection.tsx b/public/app/core/components/NavBar/BottomSection.tsx index 6987844b9ae..596fdfd945a 100644 --- a/public/app/core/components/NavBar/BottomSection.tsx +++ b/public/app/core/components/NavBar/BottomSection.tsx @@ -101,7 +101,8 @@ const getStyles = (theme: GrafanaTheme2) => ({ display: none; ${theme.breakpoints.up('md')} { - display: block; + display: flex; + flex-direction: inherit; margin-bottom: ${theme.spacing(2)}; } diff --git a/public/app/core/components/NavBar/DropdownChild.test.tsx b/public/app/core/components/NavBar/DropdownChild.test.tsx index 1552b1a5958..adfd0762e21 100644 --- a/public/app/core/components/NavBar/DropdownChild.test.tsx +++ b/public/app/core/components/NavBar/DropdownChild.test.tsx @@ -31,6 +31,12 @@ describe('DropdownChild', () => { expect(icon).toBeInTheDocument(); }); + it('displays an external link icon if the target is _blank', () => { + render(); + const icon = screen.getByTestId('external-link-icon'); + expect(icon).toBeInTheDocument(); + }); + it('displays a divider instead when isDivider is true', () => { render(); diff --git a/public/app/core/components/NavBar/DropdownChild.tsx b/public/app/core/components/NavBar/DropdownChild.tsx index 6badadb67d7..abd9c95d6f2 100644 --- a/public/app/core/components/NavBar/DropdownChild.tsx +++ b/public/app/core/components/NavBar/DropdownChild.tsx @@ -17,10 +17,15 @@ const DropdownChild = ({ isDivider = false, icon, onClick, target, text, url }: const styles = getStyles(theme); const linkContent = ( - <> - {icon && } - {text} - +
+
+ {icon && } + {text} +
+ {target === '_blank' && ( + + )} +
); let element = ( @@ -53,7 +58,17 @@ const getStyles = (theme: GrafanaTheme2) => ({ display: flex; width: 100%; `, + externalLinkIcon: css` + color: ${theme.colors.text.secondary}; + margin-left: ${theme.spacing(1)}; + `, icon: css` margin-right: ${theme.spacing(1)}; `, + linkContent: css` + display: flex; + flex: 1; + flex-direction: row; + justify-content: space-between; + `, }); diff --git a/public/app/core/components/NavBar/NavBar.tsx b/public/app/core/components/NavBar/NavBar.tsx index 19296b11984..25fdfaa35ae 100644 --- a/public/app/core/components/NavBar/NavBar.tsx +++ b/public/app/core/components/NavBar/NavBar.tsx @@ -49,16 +49,16 @@ NavBar.displayName = 'NavBar'; const getStyles = (theme: GrafanaTheme2) => ({ sidemenu: css` - border-right: 1px solid ${theme.components.panel.borderColor}; display: flex; flex-direction: column; position: fixed; - width: ${theme.components.sidemenu.width}px; z-index: ${theme.zIndex.sidemenu}; ${theme.breakpoints.up('md')} { background-color: ${theme.colors.background.primary}; + border-right: 1px solid ${theme.components.panel.borderColor}; position: relative; + width: ${theme.components.sidemenu.width}px; } .sidemenu-hidden & { diff --git a/public/app/core/components/NavBar/NavBarDropdown.tsx b/public/app/core/components/NavBar/NavBarDropdown.tsx index 1c2bea6b726..cb9856daa5d 100644 --- a/public/app/core/components/NavBar/NavBarDropdown.tsx +++ b/public/app/core/components/NavBar/NavBarDropdown.tsx @@ -23,8 +23,9 @@ const NavBarDropdown = ({ reverseDirection = false, subtitleText, }: Props) => { + const filteredItems = items.filter((item) => !item.hideFromMenu); const theme = useTheme2(); - const styles = getStyles(theme, reverseDirection); + const styles = getStyles(theme, reverseDirection, filteredItems); let header = (