From 8c88f605e42020a0647fd4c1c78d1f9d15c7acf5 Mon Sep 17 00:00:00 2001 From: Ashley Harrison Date: Fri, 31 May 2024 10:04:25 +0100 Subject: [PATCH] Chore: Migrate some more scss styles (#88484) * migrate some more styles * migrate typeahead styles * migrate tagsinput styles --- .betterer.results | 4 - .../src/components/Typeahead/Typeahead.tsx | 17 +- public/app/core/components/Footer/Footer.tsx | 46 +++- .../core/components/TagFilter/TagBadge.tsx | 2 +- .../core/components/TagFilter/TagOption.tsx | 44 ++-- public/sass/_angular.scss | 201 ++++++++++++++++++ public/sass/_grafana.scss | 3 - public/sass/base/_fonts.scss | 1 - public/sass/base/_grafana_icons.scss | 150 ------------- public/sass/components/_footer.scss | 69 ------ public/sass/components/_tagsinput.scss | 90 -------- public/sass/components/_typeahead.scss | 9 - public/sass/fonts.scss | 1 - 13 files changed, 284 insertions(+), 353 deletions(-) delete mode 100644 public/sass/base/_grafana_icons.scss delete mode 100644 public/sass/components/_footer.scss delete mode 100644 public/sass/components/_tagsinput.scss delete mode 100644 public/sass/components/_typeahead.scss delete mode 100644 public/sass/fonts.scss diff --git a/.betterer.results b/.betterer.results index 1eff969d13d..637cefd8924 100644 --- a/.betterer.results +++ b/.betterer.results @@ -1232,10 +1232,6 @@ exports[`better eslint`] = { [0, 0, 0, "Styles should be written using objects.", "5"], [0, 0, 0, "Styles should be written using objects.", "6"] ], - "public/app/core/components/TagFilter/TagOption.tsx:5381": [ - [0, 0, 0, "Styles should be written using objects.", "0"], - [0, 0, 0, "Styles should be written using objects.", "1"] - ], "public/app/core/components/TimeSeries/utils.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Do not use any type assertions.", "1"], diff --git a/packages/grafana-ui/src/components/Typeahead/Typeahead.tsx b/packages/grafana-ui/src/components/Typeahead/Typeahead.tsx index 63f4ed4a10e..c1365403da6 100644 --- a/packages/grafana-ui/src/components/Typeahead/Typeahead.tsx +++ b/packages/grafana-ui/src/components/Typeahead/Typeahead.tsx @@ -1,9 +1,10 @@ +import { css } from '@emotion/css'; import { isEqual } from 'lodash'; import React, { createRef, PureComponent } from 'react'; import ReactDOM from 'react-dom'; import { FixedSizeList } from 'react-window'; -import { ThemeContext } from '@grafana/data'; +import { GrafanaTheme2, ThemeContext } from '@grafana/data'; import { CompletionItem, CompletionItemGroup, CompletionItemKind } from '../../types/completion'; import { flattenGroupItems, calculateLongestLabel, calculateListSizes } from '../../utils/typeahead'; @@ -157,13 +158,14 @@ export class Typeahead extends PureComponent { render() { const { prefix, isOpen = false, origin } = this.props; const { allItems, listWidth, listHeight, itemHeight, hoveredItem, typeaheadIndex } = this.state; + const styles = getStyles(this.context); const showDocumentation = hoveredItem || typeaheadIndex; const documentationItem = allItems[hoveredItem ? hoveredItem : typeaheadIndex || 0]; return ( -
    +
      , {}> { return null; } } + +const getStyles = (theme: GrafanaTheme2) => ({ + typeahead: css({ + maxHeight: 300, + overflowY: 'auto', + + strong: { + color: theme.v1.palette.yellow, + }, + }), +}); diff --git a/public/app/core/components/Footer/Footer.tsx b/public/app/core/components/Footer/Footer.tsx index 16ffb45dc84..56f1211c396 100644 --- a/public/app/core/components/Footer/Footer.tsx +++ b/public/app/core/components/Footer/Footer.tsx @@ -1,8 +1,9 @@ +import { css } from '@emotion/css'; import React from 'react'; -import { LinkTarget } from '@grafana/data'; +import { GrafanaTheme2, LinkTarget } from '@grafana/data'; import { config } from '@grafana/runtime'; -import { Icon, IconName } from '@grafana/ui'; +import { Icon, IconName, useStyles2 } from '@grafana/ui'; import { t } from 'app/core/internationalization'; export interface FooterLink { @@ -100,13 +101,14 @@ export interface Props { export const Footer = React.memo(({ customLinks, hideEdition }: Props) => { const links = (customLinks || getFooterLinks()).concat(getVersionLinks(hideEdition)); + const styles = useStyles2(getStyles); return ( -