Skip to content

Commit

Permalink
fix: pr comments
Browse files Browse the repository at this point in the history
Remove legendId, fix safari max-height inheritance issue, remove uneeded legendList styles, revert
empty state flex value.
  • Loading branch information
nickofthyme committed Aug 21, 2019
1 parent 9fa3373 commit ea01ba3
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/components/_container.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

.echContainer {
flex: 1 1 auto;
flex: 1;
position: relative;

&:hover {
Expand Down
5 changes: 1 addition & 4 deletions src/components/chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Provider } from 'mobx-react';

import { SpecsParser } from '../specs/specs_parser';
import { ChartStore } from '../chart_types/xy_chart/store/chart_state';
import { htmlIdGenerator } from '../utils/commons';
import { AnnotationTooltip } from './annotation_tooltips';
import { ChartResizer } from './chart_resizer';
import { Crosshair } from './crosshair';
Expand Down Expand Up @@ -35,7 +34,6 @@ export class Chart extends React.Component<ChartProps, ChartState> {
renderer: 'canvas',
};
private chartSpecStore: ChartStore;
private legendId: string;
constructor(props: any) {
super(props);
this.chartSpecStore = new ChartStore();
Expand All @@ -48,7 +46,6 @@ export class Chart extends React.Component<ChartProps, ChartState> {
legendPosition,
});
});
this.legendId = htmlIdGenerator()('legend');
}

static getContainerStyle = (size: any): CSSProperties => {
Expand Down Expand Up @@ -91,7 +88,7 @@ export class Chart extends React.Component<ChartProps, ChartState> {
return (
<Provider chartStore={this.chartSpecStore}>
<div style={containerStyle} className={chartClassNames}>
<Legend legendId={this.legendId} />
<Legend />
<SpecsParser>{this.props.children}</SpecsParser>
<div className="echContainer">
<ChartResizer />
Expand Down
1 change: 0 additions & 1 deletion src/components/legend/_index.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@import 'variables';
@import 'legend';
@import 'legend_list';
@import 'legend_item';
3 changes: 0 additions & 3 deletions src/components/legend/_legend_list.scss

This file was deleted.

8 changes: 3 additions & 5 deletions src/components/legend/legend.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { Theme } from '../../utils/themes/theme';

interface LegendProps {
chartStore?: ChartStore; // FIX until we find a better way on ts mobx
legendId: string;
}

interface LegendState {
Expand Down Expand Up @@ -57,7 +56,6 @@ class LegendComponent extends React.Component<LegendProps, LegendState> {
}

render() {
const { legendId } = this.props;
const {
legendInitialized,
chartInitialized,
Expand All @@ -73,16 +71,16 @@ class LegendComponent extends React.Component<LegendProps, LegendState> {
return null;
}

const legendStyle = this.getLegendStyle(postion, chartTheme);
const legendContainerStyle = this.getLegendStyle(postion, chartTheme);
const legendListStyle = this.getLegendListStyle(postion, chartTheme);
const legendClasses = classNames('echLegend', `echLegend--${postion}`, {
'echLegend--debug': debug,
invisible: !chartInitialized.get(),
});

return (
<div ref={this.echLegend} className={legendClasses} style={legendStyle} id={legendId}>
<div className="echLegendListContainer">
<div ref={this.echLegend} className={legendClasses}>
<div style={legendContainerStyle} className="echLegendListContainer">
<div style={legendListStyle} className="echLegendList">
{[...legendItems.values()].map(this.renderLegendElement)}
</div>
Expand Down

0 comments on commit ea01ba3

Please sign in to comment.