41 lines
894 B
JavaScript
41 lines
894 B
JavaScript
|
/** @format */
|
||
|
/**
|
||
|
* External dependencies
|
||
|
*/
|
||
|
import { __ } from '@wordpress/i18n';
|
||
|
import { Component } from '@wordpress/element';
|
||
|
import PropTypes from 'prop-types';
|
||
|
|
||
|
/**
|
||
|
* Internal dependencies
|
||
|
*/
|
||
|
import SegmentedSelection from 'components/segmented-selection';
|
||
|
|
||
|
const compareValues = [
|
||
|
{ value: 'previous_period', label: __( 'Previous Period', 'woo-dash' ) },
|
||
|
{ value: 'previous_year', label: __( 'Previous Year', 'woo-dash' ) },
|
||
|
];
|
||
|
|
||
|
class ComparePeriods extends Component {
|
||
|
render() {
|
||
|
const { onSelect, compare } = this.props;
|
||
|
return (
|
||
|
<SegmentedSelection
|
||
|
options={ compareValues }
|
||
|
selected={ compare }
|
||
|
onSelect={ onSelect }
|
||
|
name="compare"
|
||
|
legend={ __( 'compare to', 'woo-dash' ) }
|
||
|
/>
|
||
|
);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
ComparePeriods.propTypes = {
|
||
|
onSelect: PropTypes.func.isRequired,
|
||
|
compare: PropTypes.string,
|
||
|
};
|
||
|
|
||
|
export { compareValues };
|
||
|
export default ComparePeriods;
|