Skip to content

Commit

Permalink
chore: move tooltips component to global folder
Browse files Browse the repository at this point in the history
  • Loading branch information
markov00 committed Feb 14, 2020
1 parent f3680e3 commit 4344c73
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/chart_types/xy_chart/state/chart_state.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { RefObject } from 'react';
import { InternalChartState, GlobalChartState, BackwardRef } from '../../../state/chart_state';
import { ChartTypes } from '../..';
import { Tooltips } from '../renderer/dom/tooltips';
import { Tooltip } from '../../../components/tooltip';
import { htmlIdGenerator } from '../../../utils/commons';
import { Highlighter } from '../renderer/dom/highlighter';
import { Crosshair } from '../renderer/dom/crosshair';
Expand Down Expand Up @@ -39,7 +39,7 @@ export class XYAxisChartState implements InternalChartState {
<React.Fragment>
<Crosshair />
<XYChart forwardStageRef={forwardStageRef} />
<Tooltips getChartContainerRef={containerRef} />
<Tooltip getChartContainerRef={containerRef} />
<AnnotationTooltip getChartContainerRef={containerRef} />
<Highlighter />
<BrushTool />
Expand Down
2 changes: 1 addition & 1 deletion src/components/_index.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@import 'global';
@import 'container';
@import 'annotation';
@import 'tooltip';
@import 'tooltip/index';
@import 'icons/index';
@import 'legend/index';
@import 'unavailable_chart';
Expand Down
1 change: 1 addition & 0 deletions src/components/tooltip/_index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import 'tooltip';
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import classNames from 'classnames';
import React from 'react';
import { connect } from 'react-redux';
import { TooltipValue, TooltipValueFormatter } from '../../utils/interactions';
import { GlobalChartState, BackwardRef } from '../../../../state/chart_state';
import { isTooltipVisibleSelector } from '../../state/selectors/is_tooltip_visible';
import { getTooltipHeaderFormatterSelector } from '../../state/selectors/get_tooltip_header_formatter';
import { getTooltipPositionSelector } from '../../state/selectors/get_tooltip_position';
import { getTooltipValuesSelector, TooltipData } from '../../state/selectors/get_tooltip_values_highlighted_geoms';
import { isInitialized } from '../../../../state/selectors/is_initialized';
import { TooltipValue, TooltipValueFormatter } from '../../chart_types/xy_chart/utils/interactions';
import { GlobalChartState, BackwardRef } from '../../state/chart_state';
import { isTooltipVisibleSelector } from '../../chart_types/xy_chart/state/selectors/is_tooltip_visible';
import { getTooltipHeaderFormatterSelector } from '../../chart_types/xy_chart/state/selectors/get_tooltip_header_formatter';
import { getTooltipPositionSelector } from '../../chart_types/xy_chart/state/selectors/get_tooltip_position';
import {
getTooltipValuesSelector,
TooltipData,
} from '../../chart_types/xy_chart/state/selectors/get_tooltip_values_highlighted_geoms';
import { isInitialized } from '../../state/selectors/is_initialized';
import { createPortal } from 'react-dom';
import { getFinalTooltipPosition, TooltipPosition } from '../../crosshair/crosshair_utils';
import { isAnnotationTooltipVisibleSelector } from '../../state/selectors/is_annotation_tooltip_visible';
import { getFinalTooltipPosition, TooltipPosition } from '../../chart_types/xy_chart/crosshair/crosshair_utils';
import { isAnnotationTooltipVisibleSelector } from '../../chart_types/xy_chart/state/selectors/is_annotation_tooltip_visible';

interface TooltipStateProps {
isTooltipVisible: boolean;
Expand All @@ -24,7 +27,7 @@ interface TooltipOwnProps {
}
type TooltipProps = TooltipStateProps & TooltipOwnProps;

class TooltipsComponent extends React.Component<TooltipProps> {
class TooltipComponent extends React.Component<TooltipProps> {
static displayName = 'Tooltips';
portalNode: HTMLDivElement | null = null;
tooltipRef: React.RefObject<HTMLDivElement>;
Expand Down Expand Up @@ -148,4 +151,4 @@ const mapStateToProps = (state: GlobalChartState): TooltipStateProps => {
};
};

export const Tooltips = connect(mapStateToProps)(TooltipsComponent);
export const Tooltip = connect(mapStateToProps)(TooltipComponent);

0 comments on commit 4344c73

Please sign in to comment.