From 78a57f20645b4e167ef38b55c79145b4b55b70db Mon Sep 17 00:00:00 2001 From: Ashley Harrison Date: Wed, 5 Oct 2022 12:22:47 +0100 Subject: [PATCH] Navigation: use `ToolbarButton` in `TopSearchBar` for consistency (#56371) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * use ToolbarButton in TopSearchBar for consistency * Removed unnessary styles Co-authored-by: Torkel Ödegaard --- .../AppChrome/News/NewsContainer.tsx | 12 ++--- .../components/AppChrome/TopSearchBar.tsx | 44 ++++++------------- 2 files changed, 17 insertions(+), 39 deletions(-) diff --git a/public/app/core/components/AppChrome/News/NewsContainer.tsx b/public/app/core/components/AppChrome/News/NewsContainer.tsx index 7ff107020a7..6511dac8b7f 100644 --- a/public/app/core/components/AppChrome/News/NewsContainer.tsx +++ b/public/app/core/components/AppChrome/News/NewsContainer.tsx @@ -1,16 +1,12 @@ import React from 'react'; import { useToggle } from 'react-use'; -import { Drawer, Icon } from '@grafana/ui'; +import { Drawer, ToolbarButton } from '@grafana/ui'; import { DEFAULT_FEED_URL } from 'app/plugins/panel/news/constants'; import { NewsWrapper } from './NewsWrapper'; -interface NewsContainerProps { - buttonCss?: string; -} - -export function NewsContainer({ buttonCss }: NewsContainerProps) { +export function NewsContainer() { const [showNewsDrawer, onToggleShowNewsDrawer] = useToggle(false); const onChildClick = () => { @@ -19,9 +15,7 @@ export function NewsContainer({ buttonCss }: NewsContainerProps) { return ( <> - + {showNewsDrawer && ( diff --git a/public/app/core/components/AppChrome/TopSearchBar.tsx b/public/app/core/components/AppChrome/TopSearchBar.tsx index d3fe6a94d2d..042b4ee3153 100644 --- a/public/app/core/components/AppChrome/TopSearchBar.tsx +++ b/public/app/core/components/AppChrome/TopSearchBar.tsx @@ -2,7 +2,7 @@ import { css } from '@emotion/css'; import React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; -import { Dropdown, Icon, Tooltip, useStyles2 } from '@grafana/ui'; +import { Dropdown, Icon, ToolbarButton, useStyles2 } from '@grafana/ui'; import { contextSrv } from 'app/core/core'; import { useSelector } from 'app/types'; @@ -17,7 +17,6 @@ export function TopSearchBar() { const helpNode = navIndex['help']; const profileNode = navIndex['profile']; - const signInNode = navIndex['signin']; return (
@@ -32,24 +31,18 @@ export function TopSearchBar() {
{helpNode && ( }> - + )} - - {signInNode && ( - - - {signInNode.icon && } - - - )} + {profileNode && ( }> - + )}
@@ -62,6 +55,7 @@ const getStyles = (theme: GrafanaTheme2) => { container: css({ height: TOP_BAR_LEVEL_HEIGHT, display: 'grid', + gap: theme.spacing(0.5), gridTemplateColumns: '1fr 2fr 1fr', padding: theme.spacing(0, 2), alignItems: 'center', @@ -77,25 +71,15 @@ const getStyles = (theme: GrafanaTheme2) => { searchInput: css({}), actions: css({ display: 'flex', - gap: theme.spacing(1), + gap: theme.spacing(0.5), justifyContent: 'flex-end', }), - actionItem: css({ - display: 'flex', - flexGrow: 0, - border: 'none', - boxShadow: 'none', - background: 'none', - alignItems: 'center', - - color: theme.colors.text.secondary, - '&:hover': { - background: theme.colors.background.secondary, - }, + profileButton: css({ img: { borderRadius: '50%', - width: '24px', height: '24px', + marginRight: 0, + width: '24px', }, }), };