From 9d6abbb424e00bd569a6281088830396207f8051 Mon Sep 17 00:00:00 2001 From: rozetko Date: Tue, 10 May 2022 17:56:19 +0400 Subject: [PATCH] pretty styles --- src/components/editors/IconsEditor.tsx | 2 +- src/components/editors/ThresholdsEditor.tsx | 124 +++++++++----------- 2 files changed, 59 insertions(+), 67 deletions(-) diff --git a/src/components/editors/IconsEditor.tsx b/src/components/editors/IconsEditor.tsx index db64e56..9aee9cd 100644 --- a/src/components/editors/IconsEditor.tsx +++ b/src/components/editors/IconsEditor.tsx @@ -241,7 +241,7 @@ const getStyles = stylesFactory((theme: GrafanaTheme): IconsEditorStyles => { margin-bottom: ${theme.spacing.xxs}; `, slider: css` - padding-bottom: 0; + padding-bottom: ${theme.spacing.xxs}; `, row: css` margin-bottom: ${theme.spacing.sm}; diff --git a/src/components/editors/ThresholdsEditor.tsx b/src/components/editors/ThresholdsEditor.tsx index 447128b..358a3e2 100644 --- a/src/components/editors/ThresholdsEditor.tsx +++ b/src/components/editors/ThresholdsEditor.tsx @@ -7,6 +7,7 @@ import { HorizontalGroup, IconButton, InlineField, + InlineLabel, InlineSwitch, Input, stylesFactory, @@ -18,6 +19,7 @@ import React from 'react'; import { css } from 'emotion'; import * as _ from 'lodash'; + interface Props { defaultColor: string; arcBackground: string; @@ -71,78 +73,68 @@ export function ThresholdsEditor({ onChange, value, context }: StandardEditorPro const styles = getStyles(theme.v1); return (
- - onFieldChange('defaultColor', val)} - enableNamedColors={true} - /> -
- } - /> - - onFieldChange('arcBackground', val)} - enableNamedColors={true} - /> - - } - /> + + + onFieldChange('defaultColor', val)} + enableNamedColors={true} + /> + + + + + + onFieldChange('arcBackground', val)} + enableNamedColors={true} + /> + + {config.thresholds.map((threshold, thresholdIdx) => { return ( - - onThresholdFieldChange(thresholdIdx, 'color', newVal)} - enableNamedColors={true} - /> - - } - /> onThresholdFieldChange(thresholdIdx, 'useMetric', (evt.target as any).checked)} /> - {threshold.useMetric ? ( - onThresholdFieldChange(thresholdIdx, 'metricName', newVal)} - item={fieldNamePickerSettings} - /> - ) : ( - onThresholdFieldChange(thresholdIdx, 'value', (evt.target as any).value)} - /> - )} - removeThreshold(thresholdIdx)} - tooltip="Delete Threshold" - > + + {threshold.useMetric ? ( + onThresholdFieldChange(thresholdIdx, 'metricName', newVal)} + item={fieldNamePickerSettings} + /> + ) : ( + onThresholdFieldChange(thresholdIdx, 'value', (evt.target as any).value)} + /> + )} + + + + onThresholdFieldChange(thresholdIdx, 'color', newVal)} + enableNamedColors={true} + /> + + + + + removeThreshold(thresholdIdx)} + tooltip="Delete Threshold" + > + + ); })} @@ -157,13 +149,13 @@ export function ThresholdsEditor({ onChange, value, context }: StandardEditorPro } interface ThresholdsEditorStyles { - row: string; + deleteButton: string; } const getStyles = stylesFactory((theme: GrafanaTheme): ThresholdsEditorStyles => { return { - row: css` - margin-bottom: ${theme.spacing.sm}; + deleteButton: css` + margin-right: 0px!important; `, }; });