Rename dateRangeFilter.show to showDatePicker in filters config

This commit is contained in:
Albert Juhé Lluveras 2018-12-10 16:18:17 +01:00
parent 44e97caeab
commit 93a18be2f0
3 changed files with 10 additions and 19 deletions

View File

@ -4,9 +4,7 @@
*/ */
import { __ } from '@wordpress/i18n'; import { __ } from '@wordpress/i18n';
export const dateRangeFilter = { export const showDatePicker = false;
show: false,
};
export const filters = [ export const filters = [
{ {

View File

@ -13,7 +13,7 @@ import { ReportFilters } from '@woocommerce/components';
/** /**
* Internal dependencies * Internal dependencies
*/ */
import { dateRangeFilter, filters } from './config'; import { filters, showDatePicker } from './config';
import CustomersReportTable from './table'; import CustomersReportTable from './table';
export default class CustomersReport extends Component { export default class CustomersReport extends Component {
@ -25,8 +25,8 @@ export default class CustomersReport extends Component {
<ReportFilters <ReportFilters
query={ query } query={ query }
path={ path } path={ path }
dateRangeFilter={ dateRangeFilter }
filters={ filters } filters={ filters }
showDatePicker={ showDatePicker }
/> />
<CustomersReportTable query={ query } /> <CustomersReportTable query={ query } />
</Fragment> </Fragment>

View File

@ -57,13 +57,13 @@ class ReportFilters extends Component {
} }
render() { render() {
const { dateRangeFilter, filters, query, path } = this.props; const { filters, query, path, showDatePicker } = this.props;
return ( return (
<Fragment> <Fragment>
<H className="screen-reader-text">{ __( 'Filters', 'wc-admin' ) }</H> <H className="screen-reader-text">{ __( 'Filters', 'wc-admin' ) }</H>
<Section component="div" className="woocommerce-filters"> <Section component="div" className="woocommerce-filters">
<div className="woocommerce-filters__basic-filters"> <div className="woocommerce-filters__basic-filters">
{ dateRangeFilter.show && ( { showDatePicker && (
<DatePicker key={ JSON.stringify( query ) } query={ query } path={ path } /> <DatePicker key={ JSON.stringify( query ) } query={ query } path={ path } />
) } ) }
{ filters.map( config => { { filters.map( config => {
@ -91,15 +91,6 @@ ReportFilters.propTypes = {
* Config option passed through to `AdvancedFilters` * Config option passed through to `AdvancedFilters`
*/ */
advancedFilters: PropTypes.object, advancedFilters: PropTypes.object,
/**
* Config options for the date range picker.
*/
dateRangeFilter: PropTypes.shape( {
/**
* Whether the date range filter must be shown.
*/
show: PropTypes.bool,
} ),
/** /**
* Config option passed through to `FilterPicker` - if not used, `FilterPicker` is not displayed. * Config option passed through to `FilterPicker` - if not used, `FilterPicker` is not displayed.
*/ */
@ -112,15 +103,17 @@ ReportFilters.propTypes = {
* The query string represented in object form * The query string represented in object form
*/ */
query: PropTypes.object, query: PropTypes.object,
/**
* Whether the date picker must be shown..
*/
showDatePicker: PropTypes.bool,
}; };
ReportFilters.defaultProps = { ReportFilters.defaultProps = {
advancedFilters: {}, advancedFilters: {},
dateRangeFilter: {
show: true,
},
filters: [], filters: [],
query: {}, query: {},
showDatePicker: true,
}; };
export default ReportFilters; export default ReportFilters;