Commit 5420a816 by Dominik Prokop

Render series color picker with correct theme

parent 4b9e9336
...@@ -2,6 +2,8 @@ import React, { PureComponent } from 'react'; ...@@ -2,6 +2,8 @@ import React, { PureComponent } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import { TimeSeries } from 'app/core/core'; import { TimeSeries } from 'app/core/core';
import { SeriesColorPicker } from '@grafana/ui'; import { SeriesColorPicker } from '@grafana/ui';
import { ThemeProvider } from 'app/core/utils/ConfigProvider';
import { GrafanaTheme } from '@grafana/ui/';
export const LEGEND_STATS = ['min', 'max', 'avg', 'current', 'total']; export const LEGEND_STATS = ['min', 'max', 'avg', 'current', 'total'];
...@@ -154,8 +156,8 @@ interface LegendSeriesIconState { ...@@ -154,8 +156,8 @@ interface LegendSeriesIconState {
color: string; color: string;
} }
function SeriesIcon(props) { function SeriesIcon({ color }) {
return <i className="fa fa-minus pointer" style={{ color: props.color }} />; return <i className="fa fa-minus pointer" style={{ color }} />;
} }
class LegendSeriesIcon extends PureComponent<LegendSeriesIconProps, LegendSeriesIconState> { class LegendSeriesIcon extends PureComponent<LegendSeriesIconProps, LegendSeriesIconState> {
...@@ -167,16 +169,25 @@ class LegendSeriesIcon extends PureComponent<LegendSeriesIconProps, LegendSeries ...@@ -167,16 +169,25 @@ class LegendSeriesIcon extends PureComponent<LegendSeriesIconProps, LegendSeries
render() { render() {
return ( return (
<ThemeProvider>
{theme => {
return (
<SeriesColorPicker <SeriesColorPicker
optionalClass="graph-legend-icon" optionalClass="graph-legend-icon"
yaxis={this.props.yaxis} yaxis={this.props.yaxis}
color={this.props.color} color={this.props.color}
onColorChange={this.props.onColorChange} onColorChange={this.props.onColorChange}
onToggleAxis={this.props.onToggleAxis} onToggleAxis={this.props.onToggleAxis}
theme={theme as GrafanaTheme}
> >
<span>
<SeriesIcon color={this.props.color} /> <SeriesIcon color={this.props.color} />
</span>
</SeriesColorPicker> </SeriesColorPicker>
); );
}}
</ThemeProvider>
);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment