diff --git a/packages/grafana-data/src/themes/createColors.ts b/packages/grafana-data/src/themes/createColors.ts index b7007b5148b..8a14326c65c 100644 --- a/packages/grafana-data/src/themes/createColors.ts +++ b/packages/grafana-data/src/themes/createColors.ts @@ -87,7 +87,7 @@ class DarkColors implements ThemeColorsBase> { whiteBase = '201, 209, 217'; border = { - weak: `rgba(${this.whiteBase}, 0.10)`, + weak: `rgba(${this.whiteBase}, 0.08)`, medium: `rgba(${this.whiteBase}, 0.15)`, strong: `rgba(${this.whiteBase}, 0.25)`, }; diff --git a/packages/grafana-data/src/themes/createComponents.ts b/packages/grafana-data/src/themes/createComponents.ts index 172b3c7f778..e81e695978e 100644 --- a/packages/grafana-data/src/themes/createComponents.ts +++ b/packages/grafana-data/src/themes/createComponents.ts @@ -43,8 +43,8 @@ export function createComponents(colors: ThemeColors, shadows: ThemeShadows): Th padding: 1, headerHeight: 4, background: colors.background.primary, - borderColor: colors.background.primary, - boxShadow: shadows.z1, + borderColor: colors.border.weak, + boxShadow: 'none', }; const input = { diff --git a/packages/grafana-ui/src/components/Button/ToolbarButton.tsx b/packages/grafana-ui/src/components/Button/ToolbarButton.tsx index 10c00284762..74ba6177958 100644 --- a/packages/grafana-ui/src/components/Button/ToolbarButton.tsx +++ b/packages/grafana-ui/src/components/Button/ToolbarButton.tsx @@ -118,7 +118,7 @@ const getStyles = (theme: GrafanaThemeV2) => { border-radius: ${theme.shape.borderRadius()}; line-height: ${theme.components.height.md * theme.spacing.gridSize - 2}px; font-weight: ${theme.typography.fontWeightMedium}; - border: 1px solid ${theme.colors.border.medium}; + border: 1px solid ${theme.colors.border.weak}; white-space: nowrap; transition: ${theme.transitions.create(['background', 'box-shadow', 'border-color', 'color'], { duration: theme.transitions.duration.short, @@ -135,7 +135,7 @@ const getStyles = (theme: GrafanaThemeV2) => { } &:hover { - box-shadow: ${theme.shadows.z2}; + box-shadow: ${theme.shadows.z1}; } &[disabled], diff --git a/packages/grafana-ui/src/components/TimePicker/TimeRangePicker/TimePickerCalendar.tsx b/packages/grafana-ui/src/components/TimePicker/TimeRangePicker/TimePickerCalendar.tsx index a69a98faa78..a1e9861c2f3 100644 --- a/packages/grafana-ui/src/components/TimePicker/TimeRangePicker/TimePickerCalendar.tsx +++ b/packages/grafana-ui/src/components/TimePicker/TimeRangePicker/TimePickerCalendar.tsx @@ -1,38 +1,36 @@ import React, { FormEvent, memo, useCallback } from 'react'; import { css } from '@emotion/css'; import Calendar from 'react-calendar/dist/entry.nostyle'; -import { dateTime, DateTime, dateTimeParse, GrafanaTheme, TimeZone } from '@grafana/data'; -import { stylesFactory, useTheme } from '../../../themes'; +import { dateTime, DateTime, dateTimeParse, GrafanaThemeV2, TimeZone } from '@grafana/data'; +import { stylesFactory, useTheme2 } from '../../../themes'; import { TimePickerTitle } from './TimePickerTitle'; import { Button } from '../../Button'; import { Icon } from '../../Icon/Icon'; import { Portal } from '../../Portal/Portal'; import { ClickOutsideWrapper } from '../../ClickOutsideWrapper/ClickOutsideWrapper'; -const getStyles = stylesFactory((theme: GrafanaTheme, isReversed = false) => { - const containerBorder = theme.isDark ? theme.palette.dark9 : theme.palette.gray5; - +const getStyles = stylesFactory((theme: GrafanaThemeV2, isReversed = false) => { return { container: css` top: -1px; position: absolute; ${isReversed ? 'left' : 'right'}: 544px; - box-shadow: ${isReversed ? '10px' : '0px'} 0px 20px ${theme.colors.dropdownShadow}; - background-color: ${theme.colors.bodyBg}; + box-shadow: ${theme.shadows.z3}; + background-color: ${theme.colors.background.primary}; z-index: -1; - border: 1px solid ${containerBorder}; + border: 1px solid ${theme.colors.border.weak}; border-radius: 2px 0 0 2px; &:after { display: block; - background-color: ${theme.colors.bodyBg}; + background-color: ${theme.colors.background.primary}; width: 19px; height: 100%; content: ${!isReversed ? ' ' : ''}; position: absolute; top: 0; right: -19px; - border-left: 1px solid ${theme.colors.border1}; + border-left: 1px solid ${theme.colors.border.weak}; } `, modal: css` @@ -59,10 +57,10 @@ const getStyles = stylesFactory((theme: GrafanaTheme, isReversed = false) => { }; }); -const getFooterStyles = stylesFactory((theme: GrafanaTheme) => { +const getFooterStyles = stylesFactory((theme: GrafanaThemeV2) => { return { container: css` - background-color: ${theme.colors.bodyBg}; + background-color: ${theme.colors.background.primary}; display: flex; justify-content: center; padding: 10px; @@ -76,11 +74,11 @@ const getFooterStyles = stylesFactory((theme: GrafanaTheme) => { }; }); -const getBodyStyles = stylesFactory((theme: GrafanaTheme) => { +const getBodyStyles = stylesFactory((theme: GrafanaThemeV2) => { return { title: css` color: ${theme.colors.text}; - background-color: ${theme.colors.bodyBg}; + background-color: ${theme.colors.background.primary}; font-size: ${theme.typography.size.md}; border: 1px solid transparent; @@ -90,7 +88,7 @@ const getBodyStyles = stylesFactory((theme: GrafanaTheme) => { `, body: css` z-index: ${theme.zIndex.modal}; - background-color: ${theme.colors.bodyBg}; + background-color: ${theme.colors.background.primary}; width: 268px; .react-calendar__navigation__label, @@ -100,13 +98,13 @@ const getBodyStyles = stylesFactory((theme: GrafanaTheme) => { background-color: inherit; color: ${theme.colors.text}; border: 0; - font-weight: ${theme.typography.weight.semibold}; + font-weight: ${theme.typography.fontWeightMedium}; } .react-calendar__month-view__weekdays { background-color: inherit; text-align: center; - color: ${theme.palette.blue77}; + color: ${theme.colors.primary.text}; abbr { border: 0; @@ -136,9 +134,9 @@ const getBodyStyles = stylesFactory((theme: GrafanaTheme) => { .react-calendar__tile--active, .react-calendar__tile--active:hover { - color: ${theme.palette.white}; - font-weight: ${theme.typography.weight.semibold}; - background: ${theme.palette.blue95}; + color: ${theme.colors.primary.contrastText}; + font-weight: ${theme.typography.fontWeightMedium}; + background: ${theme.colors.primary.main}; box-shadow: none; border: 0px; } @@ -147,12 +145,12 @@ const getBodyStyles = stylesFactory((theme: GrafanaTheme) => { .react-calendar__tile--rangeStart { padding: 0; border: 0px; - color: ${theme.palette.white}; - font-weight: ${theme.typography.weight.semibold}; - background: ${theme.palette.blue95}; + color: ${theme.colors.primary.contrastText}; + font-weight: ${theme.typography.fontWeightMedium}; + background: ${theme.colors.primary.main}; abbr { - background-color: ${theme.palette.blue77}; + background-color: ${theme.colors.primary.main}; border-radius: 100px; display: block; padding-top: 2px; @@ -173,10 +171,10 @@ const getBodyStyles = stylesFactory((theme: GrafanaTheme) => { }; }); -const getHeaderStyles = stylesFactory((theme: GrafanaTheme) => { +const getHeaderStyles = stylesFactory((theme: GrafanaThemeV2) => { return { container: css` - background-color: ${theme.colors.bodyBg}; + background-color: ${theme.colors.background.primary}; display: flex; justify-content: space-between; padding: 7px; @@ -199,7 +197,7 @@ interface Props { const stopPropagation = (event: React.MouseEvent) => event.stopPropagation(); export const TimePickerCalendar = memo((props) => { - const theme = useTheme(); + const theme = useTheme2(); const styles = getStyles(theme, props.isReversed); const { isOpen, isFullscreen } = props; @@ -234,7 +232,7 @@ export const TimePickerCalendar = memo((props) => { TimePickerCalendar.displayName = 'TimePickerCalendar'; const Header = memo(({ onClose }) => { - const theme = useTheme(); + const theme = useTheme2(); const styles = getHeaderStyles(theme); return ( @@ -249,7 +247,7 @@ Header.displayName = 'Header'; const Body = memo(({ onChange, from, to, timeZone }) => { const value = inputToValue(from, to); - const theme = useTheme(); + const theme = useTheme2(); const onCalendarChange = useOnCalendarChange(onChange, timeZone); const styles = getBodyStyles(theme); @@ -272,7 +270,7 @@ const Body = memo(({ onChange, from, to, timeZone }) => { Body.displayName = 'Body'; const Footer = memo(({ onClose, onApply }) => { - const theme = useTheme(); + const theme = useTheme2(); const styles = getFooterStyles(theme); return ( diff --git a/packages/grafana-ui/src/themes/GlobalStyles/elements.ts b/packages/grafana-ui/src/themes/GlobalStyles/elements.ts index ea4edf0cd2d..792c9d77bd3 100644 --- a/packages/grafana-ui/src/themes/GlobalStyles/elements.ts +++ b/packages/grafana-ui/src/themes/GlobalStyles/elements.ts @@ -53,6 +53,10 @@ export function getElementStyles(theme: GrafanaThemeV2) { button { letter-spacing: ${theme.typography.body.letterSpacing}; + + &:focus { + outline: none; + } } // Ex: 14px base font * 85% = about 12px diff --git a/packages/grafana-ui/src/themes/_variables.dark.scss.tmpl.ts b/packages/grafana-ui/src/themes/_variables.dark.scss.tmpl.ts index f8cd252dcb9..262bc621b7c 100644 --- a/packages/grafana-ui/src/themes/_variables.dark.scss.tmpl.ts +++ b/packages/grafana-ui/src/themes/_variables.dark.scss.tmpl.ts @@ -227,10 +227,11 @@ $typeahead-selected-color: $yellow; // Dropdowns // ------------------------- -$dropdownBackground: ${theme.colors.background.secondary}; +$dropdownBackground: ${theme.colors.background.primary}; $dropdownBorder: ${theme.colors.border.weak}; $dropdownDividerTop: ${theme.colors.border.weak}; $dropdownDividerBottom: ${theme.colors.border.weak}; +$dropdownShadow: ${theme.shadows.z3}; $dropdownLinkColor: $link-color; $dropdownLinkColorHover: $white; diff --git a/packages/grafana-ui/src/themes/_variables.light.scss.tmpl.ts b/packages/grafana-ui/src/themes/_variables.light.scss.tmpl.ts index 9e206e7b42f..b63aff96b60 100644 --- a/packages/grafana-ui/src/themes/_variables.light.scss.tmpl.ts +++ b/packages/grafana-ui/src/themes/_variables.light.scss.tmpl.ts @@ -222,10 +222,11 @@ $typeahead-selected-color: $yellow; // Dropdowns // ------------------------- -$dropdownBackground: ${theme.colors.background.secondary}; +$dropdownBackground: ${theme.colors.background.primary}; $dropdownBorder: ${theme.colors.border.weak}; $dropdownDividerTop: ${theme.colors.border.weak}; $dropdownDividerBottom: ${theme.colors.border.weak}; +$dropdownShadow: ${theme.shadows.z3}; $dropdownLinkColor: $dark-2; $dropdownLinkColorHover: $link-color; diff --git a/packages/grafana-ui/src/themes/_variables.scss.tmpl.ts b/packages/grafana-ui/src/themes/_variables.scss.tmpl.ts index f2a02317aec..f9ab9abc765 100644 --- a/packages/grafana-ui/src/themes/_variables.scss.tmpl.ts +++ b/packages/grafana-ui/src/themes/_variables.scss.tmpl.ts @@ -126,7 +126,7 @@ $headings-line-height: ${theme.v1.typography.lineHeight.sm} !default; $border-width: ${theme.v1.border.width.sm} !default; -$border-radius: ${theme.v1.border.radius.md} !default; +$border-radius: ${theme.v1.border.radius.sm} !default; $border-radius-lg: ${theme.v1.border.radius.lg} !default; $border-radius-sm: ${theme.v1.border.radius.sm} !default; diff --git a/public/app/features/dashboard/components/PanelEditor/PanelEditorTabs.tsx b/public/app/features/dashboard/components/PanelEditor/PanelEditorTabs.tsx index b838ac1294c..6b1d73f8948 100644 --- a/public/app/features/dashboard/components/PanelEditor/PanelEditorTabs.tsx +++ b/public/app/features/dashboard/components/PanelEditor/PanelEditorTabs.tsx @@ -36,7 +36,7 @@ export const PanelEditorTabs: FC = React.memo(({ panel, da return (
- + {tabs.map((tab) => { return ( = (props) => { const { queryError } = props; + const theme = useTheme2(); const showError = queryError ? true : false; const duration = showError ? 100 : 10; - const message = queryError?.message || queryError?.data?.message || 'Unknown error'; + const title = queryError ? 'Query error' : 'Unknown error'; + const message = queryError?.message || queryError?.data?.message || null; + const alertWithTopMargin = css` + margin-top: ${theme.spacing(2)}; + `; return ( -
-
-
- -
-
-
{message}
-
-
-
+ + {message} +
); }; diff --git a/public/app/features/explore/Explore.tsx b/public/app/features/explore/Explore.tsx index 5e5285d464e..590a5f645e2 100644 --- a/public/app/features/explore/Explore.tsx +++ b/public/app/features/explore/Explore.tsx @@ -335,8 +335,8 @@ export class Explore extends React.PureComponent { onClickRichHistoryButton={this.toggleShowRichHistory} onClickQueryInspectorButton={this.toggleShowQueryInspector} /> +
- {({ width }) => { if (width === 0) { diff --git a/public/app/features/explore/__snapshots__/ErrorContainer.test.tsx.snap b/public/app/features/explore/__snapshots__/ErrorContainer.test.tsx.snap index a7e0ccfff27..071c68f68e0 100644 --- a/public/app/features/explore/__snapshots__/ErrorContainer.test.tsx.snap +++ b/public/app/features/explore/__snapshots__/ErrorContainer.test.tsx.snap @@ -5,29 +5,12 @@ exports[`ErrorContainer should render component 1`] = ` duration={100} in={true} > -
-
-
- -
-
-
- Error message -
-
-
-
+ Error message + `; diff --git a/public/app/features/explore/__snapshots__/Explore.test.tsx.snap b/public/app/features/explore/__snapshots__/Explore.test.tsx.snap index abc9452ba4c..27e05fc8d03 100644 --- a/public/app/features/explore/__snapshots__/Explore.test.tsx.snap +++ b/public/app/features/explore/__snapshots__/Explore.test.tsx.snap @@ -27,10 +27,10 @@ exports[`Explore should render component 1`] = ` queryInspectorButtonActive={false} richHistoryButtonActive={false} /> + -