diff --git a/projects/js-packages/charts/src/components/grid-control/grid-control.tsx b/projects/js-packages/charts/src/components/grid-control/grid-control.tsx index ded6d86356778..55011d0e57e2c 100644 --- a/projects/js-packages/charts/src/components/grid-control/grid-control.tsx +++ b/projects/js-packages/charts/src/components/grid-control/grid-control.tsx @@ -1,18 +1,9 @@ import { GridRows, GridColumns } from '@visx/grid'; import React from 'react'; import styles from './grid-control.module.scss'; -import type { BaseChartProps } from '../shared/types'; +import type { BaseGridProps } from '../shared/types'; -interface GridControlProps extends BaseChartProps { - // TODO: Fix any type after resolving visx scale type issues - // eslint-disable-next-line @typescript-eslint/no-explicit-any - xScale: any; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - yScale: any; - top?: number; -} - -const GridControl: React.FC< GridControlProps > = ( { +const GridControl: React.FC< BaseGridProps > = ( { width, height, xScale, diff --git a/projects/js-packages/charts/src/components/shared/types.d.ts b/projects/js-packages/charts/src/components/shared/types.d.ts index 90b5408f662b2..17c0aa21cef98 100644 --- a/projects/js-packages/charts/src/components/shared/types.d.ts +++ b/projects/js-packages/charts/src/components/shared/types.d.ts @@ -66,48 +66,35 @@ export type ChartTheme = { }; /** - * Base properties shared across all chart components + * Base properties for grid components */ -export type BaseChartProps< T = DataPoint | DataPointDate > = { +export type BaseGridProps = { /** - * Array of data points to display in the chart - */ - data?: T extends DataPoint | DataPointDate ? T[] : T; - /** - * Additional CSS class name for the chart container - */ - className?: string; - /** - * Width of the chart in pixels + * Width of the grid in pixels */ width: number; /** - * Height of the chart in pixels - */ - height?: number; - /** - * Chart margins + * Height of the grid in pixels */ - margin?: { - top: number; - right: number; - bottom: number; - left: number; - }; + height: number; /** - * Whether to show tooltips on hover. False by default. + * Grid visibility. x is default. */ - withTooltips?: boolean; + gridVisibility?: 'x' | 'y' | 'xy' | 'none'; /** - * Whether to show legend + * X-axis scale for the grid + * TODO: Fix any type after resolving visx scale type issues */ - showLegend?: boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + xScale: any; /** - * Legend orientation + * Y-axis scale for the grid + * TODO: Fix any type after resolving visx scale type issues */ - legendOrientation?: 'horizontal' | 'vertical'; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + yScale: any; /** - * Grid visibility. x is default. + * Top offset for the grid */ - gridVisibility?: 'x' | 'y' | 'xy' | 'none'; + top?: number; };