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 (
|
||||
<PopperController content={popoverElement} hideAfter={500}>
|
||||
<PopperController content={popoverElement} hideAfter={300}>
|
||||
{(showPopper, hidePopper, popperProps) => {
|
||||
return (
|
||||
<>
|
||||
|
@ -3,6 +3,7 @@ import React, { FunctionComponent } from 'react';
|
||||
import { ColorPickerPopover } from './ColorPickerPopover';
|
||||
import { ColorPickerProps } from './ColorPicker';
|
||||
import { PopperContentProps } from '../Tooltip/PopperController';
|
||||
import { Switch } from '../Switch/Switch';
|
||||
|
||||
export interface SeriesColorPickerPopoverProps extends ColorPickerProps, PopperContentProps {
|
||||
yaxis?: number;
|
||||
@ -19,7 +20,20 @@ export const SeriesColorPickerPopover: FunctionComponent<SeriesColorPickerPopove
|
||||
customPickers={{
|
||||
yaxis: {
|
||||
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 {
|
||||
width: 336px;
|
||||
min-height: 184px;
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
.ColorPickerPopover__tabs {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
border-radius: 3px 3px 0 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.ColorPickerPopover__tab {
|
||||
@ -143,13 +146,21 @@ $arrowSize: 15px;
|
||||
text-align: center;
|
||||
padding: 8px 0;
|
||||
background: #dde4ed;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.ColorPickerPopover__tab--active {
|
||||
background: white;
|
||||
}
|
||||
|
||||
.ColorPicker__axisSwitch {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.ColorPicker__axisSwitchLabel {
|
||||
display: flex;
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.sp-replacer {
|
||||
background: inherit;
|
||||
border: none;
|
||||
|
Loading…
Reference in New Issue
Block a user