woocommerce/plugins/woocommerce-admin/docs/examples/extensions/dashboard-section/js/upcoming-events.js

40 lines
777 B
JavaScript
Raw Normal View History

2019-05-06 04:39:10 +00:00
/** @format */
/**
* External dependencies
*/
import { flatten } from 'lodash';
/**
* WooCommerce dependencies
*/
import { TableCard } from '@woocommerce/components';
const UpcomingEvents = ( { config } ) => {
const rows = flatten(
config.map( apple => {
return apple.events.map( event => {
return [
{ display: apple.title, value: 'variety' },
{ display: event.title, value: 'event' },
{ display: event.date, value: 'date' },
];
} );
} )
);
return (
<TableCard
title={ 'Upcoming Events' }
headers={ [
{ label: 'Variety', key: 'variety' },
{ label: 'Event', key: 'event' },
{ label: 'Date', key: 'date' },
] }
rows={ rows }
rowsPerPage={ 100 }
totalRows={ 1 }
/>
);
};
export default UpcomingEvents;