mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Use Switch to control y-axis in series color picker
This commit is contained in:
parent
1d3122632f
commit
5032c74b79
@ -63,7 +63,7 @@ export const colorPickerFactory = <T extends ColorPickerProps>(
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PopperController content={popoverElement} hideAfter={500}>
|
<PopperController content={popoverElement} hideAfter={300}>
|
||||||
{(showPopper, hidePopper, popperProps) => {
|
{(showPopper, hidePopper, popperProps) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -3,6 +3,7 @@ import React, { FunctionComponent } from 'react';
|
|||||||
import { ColorPickerPopover } from './ColorPickerPopover';
|
import { ColorPickerPopover } from './ColorPickerPopover';
|
||||||
import { ColorPickerProps } from './ColorPicker';
|
import { ColorPickerProps } from './ColorPicker';
|
||||||
import { PopperContentProps } from '../Tooltip/PopperController';
|
import { PopperContentProps } from '../Tooltip/PopperController';
|
||||||
|
import { Switch } from '../Switch/Switch';
|
||||||
|
|
||||||
export interface SeriesColorPickerPopoverProps extends ColorPickerProps, PopperContentProps {
|
export interface SeriesColorPickerPopoverProps extends ColorPickerProps, PopperContentProps {
|
||||||
yaxis?: number;
|
yaxis?: number;
|
||||||
@ -19,7 +20,20 @@ export const SeriesColorPickerPopover: FunctionComponent<SeriesColorPickerPopove
|
|||||||
customPickers={{
|
customPickers={{
|
||||||
yaxis: {
|
yaxis: {
|
||||||
name: 'Y-Axis',
|
name: 'Y-Axis',
|
||||||
tabComponent: () => <div style={{ marginTop: '24px' }}>{yaxis && <AxisSelector yaxis={yaxis} onToggleAxis={onToggleAxis} />}</div>
|
tabComponent: () => (
|
||||||
|
<Switch
|
||||||
|
key="yaxisSwitch"
|
||||||
|
label="Use right y-axis"
|
||||||
|
className="ColorPicker__axisSwitch"
|
||||||
|
labelClass="ColorPicker__axisSwitchLabel"
|
||||||
|
checked={yaxis === 2}
|
||||||
|
onChange={() => {
|
||||||
|
if (onToggleAxis) {
|
||||||
|
onToggleAxis();
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
),
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
@ -130,12 +130,15 @@ $arrowSize: 15px;
|
|||||||
|
|
||||||
.ColorPickerPopover__content {
|
.ColorPickerPopover__content {
|
||||||
width: 336px;
|
width: 336px;
|
||||||
|
min-height: 184px;
|
||||||
padding: 24px;
|
padding: 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ColorPickerPopover__tabs {
|
.ColorPickerPopover__tabs {
|
||||||
display: flex;
|
display: flex;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
border-radius: 3px 3px 0 0;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ColorPickerPopover__tab {
|
.ColorPickerPopover__tab {
|
||||||
@ -143,13 +146,21 @@ $arrowSize: 15px;
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
padding: 8px 0;
|
padding: 8px 0;
|
||||||
background: #dde4ed;
|
background: #dde4ed;
|
||||||
border-radius: 3px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.ColorPickerPopover__tab--active {
|
.ColorPickerPopover__tab--active {
|
||||||
background: white;
|
background: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ColorPicker__axisSwitch {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ColorPicker__axisSwitchLabel {
|
||||||
|
display: flex;
|
||||||
|
flex-grow: 1;
|
||||||
|
}
|
||||||
|
|
||||||
.sp-replacer {
|
.sp-replacer {
|
||||||
background: inherit;
|
background: inherit;
|
||||||
border: none;
|
border: none;
|
||||||
|
Loading…
Reference in New Issue
Block a user