| 1 |
/** |
| 2 |
* WordPress dependencies. |
| 3 |
*/ |
| 4 |
import { Icon } from '@wordpress/components'; |
| 5 |
import { dateI18n } from '@wordpress/date'; |
| 6 |
import { WPElement } from '@wordpress/element'; |
| 7 |
import { __ } from '@wordpress/i18n'; |
| 8 |
|
| 9 |
/** |
| 10 |
* Internal dependencies. |
| 11 |
*/ |
| 12 |
import DateTime from '../common/date-time'; |
| 13 |
import thumbsDown from '../icons/thumbs-down'; |
| 14 |
import thumbsUp from '../icons/thumbs-up'; |
| 15 |
|
| 16 |
/** |
| 17 |
* Sync button component. |
| 18 |
* |
| 19 |
* @param {object} props Component props. |
| 20 |
* @param {string} props.dateTime Sync date and time. |
| 21 |
* @param {boolean} props.isSuccess If sync was a success. |
| 22 |
* @returns {WPElement} Component. |
| 23 |
*/ |
| 24 |
export default ({ dateTime, isSuccess }) => { |
| 25 |
return ( |
| 26 |
<p |
| 27 |
className={`ep-sync-status ${ |
| 28 |
isSuccess ? `ep-sync-status--success` : `ep-sync-status--error` |
| 29 |
}`} |
| 30 |
> |
| 31 |
<Icon icon={isSuccess ? thumbsUp : thumbsDown} /> |
| 32 |
<span className="ep-sync-status__label"> |
| 33 |
{isSuccess |
| 34 |
? __('Sync success on', 'elasticpress') |
| 35 |
: __('Sync unsuccessful on', 'elasticpress')}{' '} |
| 36 |
<DateTime dateTime={dateI18n('c', dateTime)} className="ep-sync-status__time" /> |
| 37 |
</span> |
| 38 |
</p> |
| 39 |
); |
| 40 |
}; |
| 41 |
|