Skip to content

Commit

Permalink
[misc cleanup] Move new component props to file
Browse files Browse the repository at this point in the history
- TBH, the types are so simple I don't anticipate many consumers needing it, and I'd rather keep them where they're used. If consumers really do need it they can import directly from this file or use PropsOf

- use `FC<>` typing to match rest of EUI
  • Loading branch information
cee-chen committed Nov 21, 2023
1 parent 5e3b8c9 commit 472161e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
19 changes: 10 additions & 9 deletions src/components/datagrid/controls/data_grid_toolbar_control.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,20 @@
* Side Public License, v 1.
*/

import React from 'react';
import React, { FunctionComponent } from 'react';
import classNames from 'classnames';
import { EuiButtonEmpty } from '../../button';

import { EuiButtonEmpty, EuiButtonEmptyProps } from '../../button';
import { EuiNotificationBadge } from '../../badge';
import { useEuiI18n } from '../../i18n';
import { EuiDataGridToolbarControlProps } from '../data_grid_types';

export const EuiDataGridToolbarControl = ({
children,
badgeContent,
textProps,
...buttonProps
}: EuiDataGridToolbarControlProps) => {
export type EuiDataGridToolbarControlProps = EuiButtonEmptyProps & {
badgeContent?: number | string;
};

export const EuiDataGridToolbarControl: FunctionComponent<
EuiDataGridToolbarControlProps
> = ({ children, badgeContent, textProps, ...buttonProps }) => {
const badgeAriaLabel = useEuiI18n(
'euiDataGridToolbarControl.badgeAriaLabel',
'Active: {count}',
Expand Down
5 changes: 4 additions & 1 deletion src/components/datagrid/controls/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@ export {
checkOrDefaultToolBarDisplayOptions,
EuiDataGridToolbar,
} from './data_grid_toolbar';
export { EuiDataGridToolbarControl } from './data_grid_toolbar_control';
export {
EuiDataGridToolbarControl,
type EuiDataGridToolbarControlProps,
} from './data_grid_toolbar_control';
6 changes: 1 addition & 5 deletions src/components/datagrid/data_grid_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
GridOnItemsRenderedProps,
} from 'react-window';
import { EuiListGroupItemProps } from '../list_group';
import { EuiButtonEmpty, EuiButtonEmptyProps, EuiButtonIcon } from '../button';
import { EuiButtonEmpty, EuiButtonIcon } from '../button';
import { ExclusiveUnion, CommonProps, OneOf } from '../common';
import { RowHeightUtilsType } from './utils/row_heights';
import { IconType } from '../icon';
Expand Down Expand Up @@ -62,10 +62,6 @@ export interface EuiDataGridCustomToolbarProps {
columnSortingControl: ReactNode;
}

export type EuiDataGridToolbarControlProps = EuiButtonEmptyProps & {
badgeContent?: number | string;
};

export interface EuiDataGridPaginationRendererProps
extends EuiDataGridPaginationProps {
rowCount: number;
Expand Down

0 comments on commit 472161e

Please sign in to comment.