GraphNG: remove y-axis position control from series color picker in the legend (#30302)

This commit is contained in:
Dominik Prokop 2021-01-15 14:24:21 +01:00 committed by GitHub
parent c14c7b6874
commit a94c256516
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 26 deletions

View File

@ -12,11 +12,9 @@ export interface SeriesColorPickerPopoverProps extends ColorPickerProps, Popover
export const SeriesColorPickerPopover: FunctionComponent<SeriesColorPickerPopoverProps> = props => { export const SeriesColorPickerPopover: FunctionComponent<SeriesColorPickerPopoverProps> = props => {
const { yaxis, onToggleAxis, color, ...colorPickerProps } = props; const { yaxis, onToggleAxis, color, ...colorPickerProps } = props;
return (
<ColorPickerPopover const customPickers = onToggleAxis
{...colorPickerProps} ? {
color={color || '#000000'}
customPickers={{
yaxis: { yaxis: {
name: 'Y-Axis', name: 'Y-Axis',
tabComponent() { tabComponent() {
@ -36,9 +34,9 @@ export const SeriesColorPickerPopover: FunctionComponent<SeriesColorPickerPopove
); );
}, },
}, },
}} }
/> : undefined;
); return <ColorPickerPopover {...colorPickerProps} color={color || '#000000'} customPickers={customPickers} />;
}; };
interface AxisSelectorProps { interface AxisSelectorProps {

View File

@ -27,7 +27,6 @@ export const VizLegendListItem: React.FunctionComponent<Props> = ({ item, onSeri
onSeriesColorChange(item.label, color); onSeriesColorChange(item.label, color);
} }
}} }}
yAxis={item.yAxis}
/> />
<div <div
onClick={event => { onClick={event => {

View File

@ -5,28 +5,14 @@ import { SeriesIcon } from './SeriesIcon';
interface Props { interface Props {
disabled: boolean; disabled: boolean;
color: string; color: string;
yAxis: number;
onColorChange: (color: string) => void; onColorChange: (color: string) => void;
onToggleAxis?: () => void;
} }
export const VizLegendSeriesIcon: React.FunctionComponent<Props> = ({ export const VizLegendSeriesIcon: React.FunctionComponent<Props> = ({ disabled, color, onColorChange }) => {
disabled,
yAxis,
color,
onColorChange,
onToggleAxis,
}) => {
return disabled ? ( return disabled ? (
<SeriesIcon color={color} /> <SeriesIcon color={color} />
) : ( ) : (
<SeriesColorPicker <SeriesColorPicker color={color} onChange={onColorChange} enableNamedColors>
yaxis={yAxis}
color={color}
onChange={onColorChange}
onToggleAxis={onToggleAxis}
enableNamedColors
>
{({ ref, showColorPicker, hideColorPicker }) => ( {({ ref, showColorPicker, hideColorPicker }) => (
<SeriesIcon <SeriesIcon
color={color} color={color}

View File

@ -35,7 +35,6 @@ export const LegendTableItem: React.FunctionComponent<Props> = ({
onSeriesColorChange(item.label, color); onSeriesColorChange(item.label, color);
} }
}} }}
yAxis={item.yAxis}
/> />
<div <div
onClick={event => { onClick={event => {