Skip to content

Commit

Permalink
EuiTableHeaderCellCheckbox convert to TS
Browse files Browse the repository at this point in the history
  • Loading branch information
Theo committed May 29, 2019
1 parent 0d3c199 commit e89d4b2
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,6 @@ exports[`EuiBasicTable footers render with pagination, selection, sorting, and f
<EuiTableHeader>
<EuiTableHeaderCellCheckbox
key="_selection_column_h"
scope="col"
width="24px"
>
<EuiI18n
Expand Down Expand Up @@ -1769,7 +1768,6 @@ exports[`EuiBasicTable with pagination and selection 1`] = `
<EuiTableHeader>
<EuiTableHeaderCellCheckbox
key="_selection_column_h"
scope="col"
width="24px"
>
<EuiI18n
Expand Down Expand Up @@ -2082,7 +2080,6 @@ exports[`EuiBasicTable with pagination, selection and sorting 1`] = `
<EuiTableHeader>
<EuiTableHeaderCellCheckbox
key="_selection_column_h"
scope="col"
width="24px"
>
<EuiI18n
Expand Down Expand Up @@ -2274,7 +2271,6 @@ exports[`EuiBasicTable with pagination, selection, sorting and a single record a
<EuiTableHeader>
<EuiTableHeaderCellCheckbox
key="_selection_column_h"
scope="col"
width="24px"
>
<EuiI18n
Expand Down Expand Up @@ -2580,7 +2576,6 @@ exports[`EuiBasicTable with pagination, selection, sorting and column dataType 1
<EuiTableHeader>
<EuiTableHeaderCellCheckbox
key="_selection_column_h"
scope="col"
width="24px"
>
<EuiI18n
Expand Down Expand Up @@ -2772,7 +2767,6 @@ exports[`EuiBasicTable with pagination, selection, sorting and column renderer 1
<EuiTableHeader>
<EuiTableHeaderCellCheckbox
key="_selection_column_h"
scope="col"
width="24px"
>
<EuiI18n
Expand Down Expand Up @@ -2964,7 +2958,6 @@ exports[`EuiBasicTable with pagination, selection, sorting and multiple record a
<EuiTableHeader>
<EuiTableHeaderCellCheckbox
key="_selection_column_h"
scope="col"
width="24px"
>
<EuiI18n
Expand Down Expand Up @@ -3288,7 +3281,6 @@ exports[`EuiBasicTable with pagination, selection, sorting, column renderer and
<EuiTableHeader>
<EuiTableHeaderCellCheckbox
key="_selection_column_h"
scope="col"
width="24px"
>
<EuiI18n
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ exports[`EuiTableHeaderCellCheckbox is rendered 1`] = `
aria-label="aria-label"
class="euiTableHeaderCellCheckbox testClass1 testClass2"
data-test-subj="test subject string"
scope="col"
>
<div
class="euiTableCellContent"
Expand Down
24 changes: 8 additions & 16 deletions src/components/table/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
import { CommonProps, NoArgCallback } from '../common';
import { IconType } from '../icon';
import { HorizontalAlignment } from '../../services/alignment';
import {
EuiTableHeaderCellCheckboxScope as TableHeaderCellCheckboxScope,
EuiTableHeaderCellCheckboxProps as TableHeaderCellCheckboxProps,
EuiTableHeaderCellCheckbox as TableHeaderCellCheckbox,
} from './table_header_cell_checkbox';

import {
FunctionComponent,
Expand Down Expand Up @@ -101,22 +106,9 @@ declare module '@elastic/eui' {
* @see './table_header_cell_checkbox.js'
*/

export type EuiTableHeaderCellCheckboxScope =
| 'col'
| 'row'
| 'colgroup'
| 'rowgroup';

export interface EuiTableHeaderCellCheckboxProps {
width?: string;
scope?: EuiTableHeaderCellCheckboxScope;
}

export const EuiTableHeaderCellCheckbox: FunctionComponent<
CommonProps &
TdHTMLAttributes<HTMLTableCellElement> &
EuiTableHeaderCellCheckboxProps
>;
export type EuiTableHeaderCellCheckboxScope = TableHeaderCellCheckboxScope;
export interface EuiTableHeaderCellCheckboxProps extends TableHeaderCellCheckboxProps {}
export const EuiTableHeaderCellCheckbox: typeof TableHeaderCellCheckbox;

/**
* table row type defs
Expand Down
27 changes: 0 additions & 27 deletions src/components/table/table_header_cell_checkbox.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { render } from 'enzyme';
import { requiredProps } from '../../test/required_props';
import { requiredProps } from '../../test';

import { EuiTableHeaderCellCheckbox } from './table_header_cell_checkbox';

Expand Down
28 changes: 28 additions & 0 deletions src/components/table/table_header_cell_checkbox.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React, { FunctionComponent, TdHTMLAttributes } from 'react';
import classNames from 'classnames';
import { CommonProps } from '../common';

export type EuiTableHeaderCellCheckboxScope =
| 'col'
| 'row'
| 'colgroup'
| 'rowgroup';

export interface EuiTableHeaderCellCheckboxProps {
width?: string;
scope?: EuiTableHeaderCellCheckboxScope;
}

export const EuiTableHeaderCellCheckbox: FunctionComponent<
CommonProps &
TdHTMLAttributes<HTMLTableCellElement> &
EuiTableHeaderCellCheckboxProps
> = ({ children, className, ...rest }) => {
const classes = classNames('euiTableHeaderCellCheckbox', className);

return (
<th className={classes} {...rest}>
<div className="euiTableCellContent">{children}</div>
</th>
);
};

0 comments on commit e89d4b2

Please sign in to comment.