index.js
53 lines
| 1 | import {Link} from 'react-router-dom'; |
| 2 | import {FontAwesomeIcon} from '@fortawesome/react-fontawesome'; |
| 3 | import {__} from '@wordpress/i18n'; |
| 4 | import {useWindowSize} from '../../hooks'; |
| 5 | |
| 6 | const DonationRow = ({donation}) => { |
| 7 | const {id, form, payment} = donation; |
| 8 | const {width} = useWindowSize(); |
| 9 | |
| 10 | return ( |
| 11 | <div className="give-donor-dashboard-table__row"> |
| 12 | <div className="give-donor-dashboard-table__column"> |
| 13 | {width < 920 && <div className="give-donor-dashboard-table__mobile-header">{__('Amount', 'give')}</div>} |
| 14 | <div className="give-donor-dashboard-table__donation-amount">{payment.amount}</div> |
| 15 | </div> |
| 16 | <div className="give-donor-dashboard-table__column"> |
| 17 | {width < 920 && <div className="give-donor-dashboard-table__mobile-header">{__('Form', 'give')}</div>} |
| 18 | {form.title} |
| 19 | </div> |
| 20 | <div className="give-donor-dashboard-table__column"> |
| 21 | {width < 920 && <div className="give-donor-dashboard-table__mobile-header">{__('Date', 'give')}</div>} |
| 22 | <div className="give-donor-dashboard-table__donation-date">{payment.date}</div> |
| 23 | <div className="give-donor-dashboard-table__donation-time">{payment.time}</div> |
| 24 | </div> |
| 25 | <div className="give-donor-dashboard-table__column"> |
| 26 | {width < 920 && <div className="give-donor-dashboard-table__mobile-header">{__('Status', 'give')}</div>} |
| 27 | <div className="give-donor-dashboard-table__donation-status"> |
| 28 | <div |
| 29 | className="give-donor-dashboard-table__donation-status-indicator" |
| 30 | style={{background: payment.status.color}} |
| 31 | /> |
| 32 | <div className="give-donor-dashboard-table__donation-status-label">{payment.status.label}</div> |
| 33 | </div> |
| 34 | {payment.mode === 'test' && ( |
| 35 | <div className="give-donor-dashboard-table__donation-test-tag">{__('Test Donation', 'give')}</div> |
| 36 | )} |
| 37 | </div> |
| 38 | <div className="give-donor-dashboard-table__pill"> |
| 39 | <div className="give-donor-dashboard-table__donation-id"> |
| 40 | {__('ID', 'give')}: {payment.serialCode} |
| 41 | </div> |
| 42 | <div className="give-donor-dashboard-table__donation-receipt"> |
| 43 | <Link to={`/donation-history/${id}`}> |
| 44 | {__('View Receipt', 'give')} <FontAwesomeIcon icon="arrow-right" /> |
| 45 | </Link> |
| 46 | </div> |
| 47 | </div> |
| 48 | </div> |
| 49 | ); |
| 50 | }; |
| 51 | |
| 52 | export default DonationRow; |
| 53 |