Fix error in using TableCard's example pagination control.

This commit is contained in:
Jeff Stieler 2019-08-30 10:18:40 -07:00
parent 499365d5ef
commit f5c153e678
1 changed files with 21 additions and 5 deletions

View File

@ -12,7 +12,11 @@ import {
TableSummary,
} from '@woocommerce/components';
const noop = () => {};
/**
* External dependencies
*/
import { withState } from '@wordpress/compose';
const headers = [
{ key: 'month', label: 'Month' },
{ key: 'orders', label: 'Orders' },
@ -41,7 +45,11 @@ const summary = [
{ label: 'Shipping', value: '$50.00' },
];
export default () => (
export default withState( {
query: {
paged: 1,
},
} )( ( { query, setState } ) => (
<div>
<H>TableCard</H>
<Section component={ false }>
@ -49,8 +57,16 @@ export default () => (
title="Revenue Last Week"
rows={ rows }
headers={ headers }
onQueryChange={ noop }
query={ { page: 2 } }
onQueryChange={
( param ) => (
( value ) => setState( {
query: {
[ param ]: value,
},
} )
)
}
query={ query }
rowsPerPage={ 7 }
totalRows={ 10 }
summary={ summary }
@ -86,4 +102,4 @@ export default () => (
</EmptyTable>
</Section>
</div>
);
) );