Skip to content

Commit ea01ba3

Browse files
committed
fix: pr comments
Remove legendId, fix safari max-height inheritance issue, remove uneeded legendList styles, revert empty state flex value.
1 parent 9fa3373 commit ea01ba3

File tree

5 files changed

+5
-14
lines changed

5 files changed

+5
-14
lines changed

src/components/_container.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44

55
.echContainer {
6-
flex: 1 1 auto;
6+
flex: 1;
77
position: relative;
88

99
&:hover {

src/components/chart.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { Provider } from 'mobx-react';
44

55
import { SpecsParser } from '../specs/specs_parser';
66
import { ChartStore } from '../chart_types/xy_chart/store/chart_state';
7-
import { htmlIdGenerator } from '../utils/commons';
87
import { AnnotationTooltip } from './annotation_tooltips';
98
import { ChartResizer } from './chart_resizer';
109
import { Crosshair } from './crosshair';
@@ -35,7 +34,6 @@ export class Chart extends React.Component<ChartProps, ChartState> {
3534
renderer: 'canvas',
3635
};
3736
private chartSpecStore: ChartStore;
38-
private legendId: string;
3937
constructor(props: any) {
4038
super(props);
4139
this.chartSpecStore = new ChartStore();
@@ -48,7 +46,6 @@ export class Chart extends React.Component<ChartProps, ChartState> {
4846
legendPosition,
4947
});
5048
});
51-
this.legendId = htmlIdGenerator()('legend');
5249
}
5350

5451
static getContainerStyle = (size: any): CSSProperties => {
@@ -91,7 +88,7 @@ export class Chart extends React.Component<ChartProps, ChartState> {
9188
return (
9289
<Provider chartStore={this.chartSpecStore}>
9390
<div style={containerStyle} className={chartClassNames}>
94-
<Legend legendId={this.legendId} />
91+
<Legend />
9592
<SpecsParser>{this.props.children}</SpecsParser>
9693
<div className="echContainer">
9794
<ChartResizer />

src/components/legend/_index.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
@import 'variables';
22
@import 'legend';
3-
@import 'legend_list';
43
@import 'legend_item';

src/components/legend/_legend_list.scss

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/components/legend/legend.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { Theme } from '../../utils/themes/theme';
1010

1111
interface LegendProps {
1212
chartStore?: ChartStore; // FIX until we find a better way on ts mobx
13-
legendId: string;
1413
}
1514

1615
interface LegendState {
@@ -57,7 +56,6 @@ class LegendComponent extends React.Component<LegendProps, LegendState> {
5756
}
5857

5958
render() {
60-
const { legendId } = this.props;
6159
const {
6260
legendInitialized,
6361
chartInitialized,
@@ -73,16 +71,16 @@ class LegendComponent extends React.Component<LegendProps, LegendState> {
7371
return null;
7472
}
7573

76-
const legendStyle = this.getLegendStyle(postion, chartTheme);
74+
const legendContainerStyle = this.getLegendStyle(postion, chartTheme);
7775
const legendListStyle = this.getLegendListStyle(postion, chartTheme);
7876
const legendClasses = classNames('echLegend', `echLegend--${postion}`, {
7977
'echLegend--debug': debug,
8078
invisible: !chartInitialized.get(),
8179
});
8280

8381
return (
84-
<div ref={this.echLegend} className={legendClasses} style={legendStyle} id={legendId}>
85-
<div className="echLegendListContainer">
82+
<div ref={this.echLegend} className={legendClasses}>
83+
<div style={legendContainerStyle} className="echLegendListContainer">
8684
<div style={legendListStyle} className="echLegendList">
8785
{[...legendItems.values()].map(this.renderLegendElement)}
8886
</div>

0 commit comments

Comments
 (0)