Skip to content

Commit

Permalink
Updated first table example to test loading toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
chandlerprall committed Jan 13, 2020
1 parent ea122a5 commit 7942eee
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src-docs/src/views/tables/basic/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
EuiBasicTable,
EuiLink,
EuiHealth,
EuiPopover,
} from '../../../../../src/components';

/*
Expand All @@ -32,7 +33,22 @@ Example country object:

const store = createDataStore();

function CountryColumn({ country }) {
const [isOpen, setIsOpen] = React.useState(false);

return (
<EuiPopover
isOpen={isOpen}
closePopover={() => setIsOpen(false)}
button={<span onClick={() => setIsOpen(!isOpen)}>{country}</span>}>
Country: {country}
</EuiPopover>
);
}

export const Table = () => {
const [isLoading, setIsLoading] = React.useState(false);
window.setIsLoading = setIsLoading;
const columns = [
{
field: 'firstName',
Expand Down Expand Up @@ -82,7 +98,7 @@ export const Table = () => {
name: 'Nationality',
render: countryCode => {
const country = store.getCountry(countryCode);
return `${country.flag} ${country.name}`;
return <CountryColumn country={`${country.flag} ${country.name}`} />;
},
},
{
Expand Down Expand Up @@ -120,6 +136,7 @@ export const Table = () => {

return (
<EuiBasicTable
loading={isLoading}
items={items}
columns={columns}
rowProps={getRowProps}
Expand Down

0 comments on commit 7942eee

Please sign in to comment.