Skip to content

Commit

Permalink
Remove ts-ignore from icons and move toolbar button to shared components
Browse files Browse the repository at this point in the history
  • Loading branch information
stratoula committed Sep 14, 2020
1 parent 9532136 commit 12aa5db
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@

import * as React from 'react';

export const EuiIconAxisBottom = ({ title, titleId, ...props }) => (
export const EuiIconAxisBottom = ({
title,
titleId,
...props
}: {
title: string;
titleId: string;
}) => (
<svg
width={16}
height={16}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@

import * as React from 'react';

export const EuiIconAxisLeft = ({ title, titleId, ...props }) => (
export const EuiIconAxisLeft = ({
title,
titleId,
...props
}: {
title: string;
titleId: string;
}) => (
<svg
width={16}
height={16}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@

import * as React from 'react';

export const EuiIconAxisRight = ({ title, titleId, ...props }) => (
export const EuiIconAxisRight = ({
title,
titleId,
...props
}: {
title: string;
titleId: string;
}) => (
<svg
width={16}
height={16}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@

import * as React from 'react';

export const EuiIconAxisTop = ({ title, titleId, ...props }) => (
export const EuiIconAxisTop = ({
title,
titleId,
...props
}: {
title: string;
titleId: string;
}) => (
<svg
width={16}
height={16}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { EuiPopover, EuiToolTip } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { NativeRenderer } from '../../../native_renderer';
import { Visualization, VisualizationLayerWidgetProps } from '../../../types';
import { ToolbarButton } from '../../../toolbar_button';
import { ToolbarButton } from '../../../shared_components';

export function LayerSettings({
layerId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { Visualization, FramePublicAPI, Datasource } from '../../../types';
import { Action } from '../state_management';
import { getSuggestions, switchToSuggestion, Suggestion } from '../suggestion_helpers';
import { trackUiEvent } from '../../../lens_ui_telemetry';
import { ToolbarButton } from '../../../toolbar_button';
import { ToolbarButton } from '../../../shared_components';

interface VisualizationSelection {
visualizationId: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { EuiPopover, EuiPopoverTitle, EuiSelectable } from '@elastic/eui';
import { EuiSelectableProps } from '@elastic/eui/src/components/selectable/selectable';
import { IndexPatternRef } from './types';
import { trackUiEvent } from '../lens_ui_telemetry';
import { ToolbarButtonProps, ToolbarButton } from '../toolbar_button';
import { ToolbarButtonProps, ToolbarButton } from '../shared_components';

export type ChangeIndexPatternTriggerProps = ToolbarButtonProps & {
label: string;
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/lens/public/shared_components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@

export * from './empty_placeholder';
export { ToolbarPopoverProps, ToolbarPopover } from './toolbar_popover';
export { ToolbarButtonProps, ToolbarButton } from './toolbar_button';
export { LegendSettingsPopover } from './legend_settings_popover';
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import React, { useState } from 'react';
import { EuiFlexItem, EuiPopover, EuiIcon, EuiPopoverTitle, IconType } from '@elastic/eui';
import { ToolbarButton, ToolbarButtonProps } from '../toolbar_button';
import { ToolbarButton, ToolbarButtonProps } from './toolbar_button';
import { EuiIconLegend } from '../assets/legend';

const typeToIconMap: { [type: string]: string | IconType } = {
Expand Down
7 changes: 0 additions & 7 deletions x-pack/plugins/lens/public/toolbar_button/index.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,11 @@ import {
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { LayerConfig, AxesSettingsConfig } from './types';
import { ToolbarPopover } from '../shared_components';
import { ToolbarButtonProps } from '../toolbar_button';
import { ToolbarPopover, ToolbarButtonProps } from '../shared_components';
import { isHorizontalChart } from './state_helpers';
// @ts-ignore
import { EuiIconAxisBottom } from '../assets/axis_bottom';
// @ts-ignore
import { EuiIconAxisLeft } from '../assets/axis_left';
// @ts-ignore
import { EuiIconAxisRight } from '../assets/axis_right';
// @ts-ignore
import { EuiIconAxisTop } from '../assets/axis_top';

type AxesSettingsConfigKeys = keyof AxesSettingsConfig;
Expand Down Expand Up @@ -82,7 +77,7 @@ const popoverConfig = (
switch (axis) {
case 'yLeft':
return {
icon: isHorizontal ? EuiIconAxisBottom : EuiIconAxisLeft,
icon: (isHorizontal ? EuiIconAxisBottom : EuiIconAxisLeft) as IconType,
groupPosition: 'left',
popoverTitle: isHorizontal
? i18n.translate('xpack.lens.xyChart.bottomAxisLabel', {
Expand All @@ -94,7 +89,7 @@ const popoverConfig = (
};
case 'yRight':
return {
icon: isHorizontal ? EuiIconAxisTop : EuiIconAxisRight,
icon: (isHorizontal ? EuiIconAxisTop : EuiIconAxisRight) as IconType,
groupPosition: 'right',
popoverTitle: isHorizontal
? i18n.translate('xpack.lens.xyChart.topAxisLabel', {
Expand All @@ -107,7 +102,7 @@ const popoverConfig = (
case 'x':
default:
return {
icon: isHorizontal ? EuiIconAxisLeft : EuiIconAxisBottom,
icon: (isHorizontal ? EuiIconAxisLeft : EuiIconAxisBottom) as IconType,
groupPosition: 'center',
popoverTitle: isHorizontal
? i18n.translate('xpack.lens.xyChart.leftAxisLabel', {
Expand Down

0 comments on commit 12aa5db

Please sign in to comment.