Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scope prop to EuiTableHeaderCell and EuiTableHeaderCellCheckbox. #171

Merged
merged 2 commits into from
Nov 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
sprites [(#160)](https://github.com/elastic/eui/pull/160)
- Add `isReadOnly`, `setOptions`, and `cursorStart` props to `<EuiCodeEditor>` ([#169](https://github.com/elastic/eui/pull/169))
- Add `wrap` prop to `<EuiFlexGroup>` ([#170](https://github.com/elastic/eui/pull/170))
- Add `scope` prop to `<EuiTableHeaderCell>` and `<EuiTableHeaderCellCheckbox>` ([#171](https://github.com/elastic/eui/pull/171))

**Bug fixes**

Expand Down
2 changes: 2 additions & 0 deletions src/components/table/__snapshots__/table.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ exports[`renders EuiTable 1`] = `
<tr>
<th
class="euiTableHeaderCell"
scope="col"
>
<div
class="euiTableCellContent"
Expand All @@ -19,6 +20,7 @@ exports[`renders EuiTable 1`] = `
</th>
<th
class="euiTableHeaderCell"
scope="col"
>
<div
class="euiTableCellContent"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
exports[`align defaults to left 1`] = `
<th
class="euiTableHeaderCell"
scope="col"
>
<div
class="euiTableCellContent"
Expand All @@ -13,6 +14,7 @@ exports[`align defaults to left 1`] = `
exports[`align renders right when specified 1`] = `
<th
class="euiTableHeaderCell"
scope="col"
>
<div
class="euiTableCellContent euiTableCellContent--alignRight"
Expand All @@ -25,6 +27,7 @@ exports[`renders EuiTableHeaderCell 1`] = `
aria-label="aria-label"
class="euiTableHeaderCell testClass1 testClass2"
data-test-subj="test subject string"
scope="col"
>
<div
class="euiTableCellContent testClass1 testClass2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ 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
5 changes: 5 additions & 0 deletions src/components/table/table_header_cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const EuiTableHeaderCell = ({
isSortAscending,
className,
ariaLabel,
scope,
...rest
}) => {
const classes = classNames('euiTableHeaderCell', className);
Expand Down Expand Up @@ -51,6 +52,7 @@ export const EuiTableHeaderCell = ({
return (
<th
className={classes}
scope={scope}
{...rest}
>
<button
Expand All @@ -72,6 +74,7 @@ export const EuiTableHeaderCell = ({
<th
className={classes}
aria-label={ariaLabel}
scope={scope}
{...rest}
>
<div className={contentClasses}>
Expand All @@ -88,8 +91,10 @@ EuiTableHeaderCell.propTypes = {
onSort: PropTypes.func,
isSorted: PropTypes.bool,
isSortAscending: PropTypes.bool,
scope: PropTypes.oneOf(['col', 'row', 'colgroup', 'rowgroup']),
};

EuiTableHeaderCell.defaultProps = {
align: LEFT_ALIGNMENT,
scope: 'col',
};
5 changes: 5 additions & 0 deletions src/components/table/table_header_cell_checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,9 @@ export const EuiTableHeaderCellCheckbox = ({
EuiTableHeaderCellCheckbox.propTypes = {
children: PropTypes.node,
className: PropTypes.string,
scope: PropTypes.oneOf(['col', 'row', 'colgroup', 'rowgroup']),
};

EuiTableHeaderCellCheckbox.defaultProps = {
scope: 'col',
};