Skip to content

Commit

Permalink
Support nodes in EuiBasicTable column headers (#1234)
Browse files Browse the repository at this point in the history
  • Loading branch information
cjcenizal authored Oct 10, 2018
1 parent 0cf8fde commit aa50e32
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 241 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## [`master`](https://github.com/elastic/eui/tree/master)

No public interface changes since `4.4.1`.
- Added support for nodes as column headers in `EuiBasicTable` for supporting things like tooltips and localized text. ([#1234](https://github.com/elastic/eui/pull/1234))

## [`4.4.1`](https://github.com/elastic/eui/tree/v4.4.1)

Expand Down
6 changes: 3 additions & 3 deletions src-docs/src/views/tables/basic/props_info.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export const propsInfo = {
name: {
description: 'The display name of the column',
required: true,
type: { name: 'string' }
type: { name: 'PropTypes.node' }
},
description: {
description: 'A description of the column (will be presented as a title over the column header',
Expand Down Expand Up @@ -213,7 +213,7 @@ export const propsInfo = {
name: {
description: 'The display name of the column',
required: false,
type: { name: 'string' }
type: { name: 'PropTypes.node' }
},
description: {
description: 'A description of the column (will be presented as a title over the column header',
Expand Down Expand Up @@ -248,7 +248,7 @@ export const propsInfo = {
name: {
description: 'The display name of the column',
required: false,
type: { name: 'string' }
type: { name: 'PropTypes.node' }
},
description: {
description: 'A description of the column (will be presented as a title over the column header',
Expand Down
217 changes: 0 additions & 217 deletions src-docs/src/views/tables/custom/compressed.js

This file was deleted.

2 changes: 0 additions & 2 deletions src-docs/src/views/tables/custom/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,6 @@ export default class extends Component {
footers.push(
<EuiTableFooterCell
key={`footer_${column.id}`}
header={column.title}
align={column.alignment}
>
{footer}
Expand All @@ -591,7 +590,6 @@ export default class extends Component {
footers.push(
<EuiTableFooterCell
key={`footer_empty_${footers.length - 1}`}
header={column.title}
align={column.alignment}
>
{undefined}
Expand Down
38 changes: 32 additions & 6 deletions src-docs/src/views/tables/sorting/sorting.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import React, {
Component
Component,
} from 'react';
import { formatDate } from '../../../../../src/services/format';
import { createDataStore } from '../data_store';

import {
EuiBasicTable,
EuiLink,
EuiHealth,
EuiIcon,
EuiLink,
EuiToolTip,
} from '../../../../../src/components';

/*
Expand Down Expand Up @@ -99,28 +101,52 @@ export class Table extends Component {
)
}, {
field: 'github',
name: 'Github',
name: (
<EuiToolTip content="Their mascot is the Octokitty">
<span>
Github <EuiIcon size="s" color="subdued" type="questionInCircle" />
</span>
</EuiToolTip>
),
render: (username) => (
<EuiLink href={`https://github.com/${username}`} target="_blank">
{username}
</EuiLink>
)
}, {
field: 'dateOfBirth',
name: 'Date of Birth',
name: (
<EuiToolTip content="Colloquially known as a 'birthday'">
<span>
Date of Birth <EuiIcon size="s" color="subdued" type="questionInCircle" />
</span>
</EuiToolTip>
),
dataType: 'date',
render: (date) => formatDate(date, 'dobLong'),
sortable: true
}, {
field: 'nationality',
name: 'Nationality',
name: (
<EuiToolTip content="The nation in which this person resides">
<span>
Nationality <EuiIcon size="s" color="subdued" type="questionInCircle" />
</span>
</EuiToolTip>
),
render: (countryCode) => {
const country = store.getCountry(countryCode);
return `${country.flag} ${country.name}`;
}
}, {
field: 'online',
name: 'Online',
name: (
<EuiToolTip content="Free to talk or busy with business">
<span>
Online <EuiIcon size="s" color="subdued" type="questionInCircle" />
</span>
</EuiToolTip>
),
dataType: 'boolean',
render: (online) => {
const color = online ? 'success' : 'danger';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,6 @@ exports[`EuiBasicTable footers render with pagination, selection, sorting, and f
/>
<EuiTableFooterCell
align="left"
header="Name"
key="footer_name"
>
<strong>
Expand All @@ -730,14 +729,12 @@ exports[`EuiBasicTable footers render with pagination, selection, sorting, and f
</EuiTableFooterCell>
<EuiTableFooterCell
align="left"
header="ID"
key="footer_id"
>
ID
</EuiTableFooterCell>
<EuiTableFooterCell
align="left"
header="Age"
key="footer_age"
>
<strong>
Expand Down
Loading

0 comments on commit aa50e32

Please sign in to comment.