From 5b3db23b9a0c9b49e123c1b6edbc2fa699aa6443 Mon Sep 17 00:00:00 2001 From: rozetko Date: Tue, 10 May 2022 17:16:24 +0400 Subject: [PATCH] thresholds styles --- src/components/editors/ThresholdsEditor.tsx | 24 +++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/components/editors/ThresholdsEditor.tsx b/src/components/editors/ThresholdsEditor.tsx index 3b0a8c8..08bd027 100644 --- a/src/components/editors/ThresholdsEditor.tsx +++ b/src/components/editors/ThresholdsEditor.tsx @@ -1,6 +1,6 @@ import { FieldNamePicker } from '../../grafana/MatchersUI/FieldNamePicker'; -import { StandardEditorProps } from '@grafana/data'; +import { GrafanaTheme, StandardEditorProps } from '@grafana/data'; import { Button, ColorPicker, @@ -9,11 +9,13 @@ import { InlineField, InlineSwitch, Input, + stylesFactory, ThemeContext, } from '@grafana/ui'; import React from 'react'; +import { css } from 'emotion'; import * as _ from 'lodash'; interface Props { @@ -65,11 +67,12 @@ export function ThresholdsEditor({ onChange, value, context }: StandardEditorPro return ( - {() => { - // const styles = getStyles(theme.v1); + {(theme) => { + const styles = getStyles(theme.v1); return (
{config.thresholds.map((threshold, thresholdIdx) => { return ( - + ); } + +interface ThresholdsEditorStyles { + row: string; +} + +const getStyles = stylesFactory((theme: GrafanaTheme): ThresholdsEditorStyles => { + return { + row: css` + margin-bottom: ${theme.spacing.sm}; + `, + }; +});