File size: 1,180 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
import { Button } from '@wordpress/components';
import { useTranslate } from 'i18n-calypso';
import { FunctionComponent } from 'react';
// eslint-disable-next-line @typescript-eslint/no-empty-function
const noop = () => {};
interface Props {
onApplyClick: () => void;
onCancelClick: () => void;
applyButtonText: string | null | undefined;
cancelButtonText: string | null | undefined;
}
const DateRangeFooter: FunctionComponent< Props > = ( {
onCancelClick = noop,
onApplyClick = noop,
cancelButtonText,
applyButtonText,
} ) => {
const translate = useTranslate();
const cancelText = cancelButtonText || translate( 'Cancel' );
const applyText = applyButtonText || translate( 'Apply' );
return (
<div className="date-range__popover-footer">
<Button
className="date-range__cancel-btn"
onClick={ onCancelClick }
variant="secondary"
size="compact"
aria-label={ cancelText }
>
{ cancelText }
</Button>
<Button
className="date-range__apply-btn"
onClick={ onApplyClick }
variant="primary"
size="compact"
aria-label={ applyText }
>
{ applyText }
</Button>
</div>
);
};
export default DateRangeFooter;
|