Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Paragon table deprecation migration to DataTable #200

33 changes: 19 additions & 14 deletions src/order-history/OrderHistoryPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
FormattedDate,
FormattedNumber,
} from '@edx/frontend-platform/i18n';
import { Table, Hyperlink, Pagination } from '@edx/paragon';
import { DataTable, Hyperlink, Pagination } from '@edx/paragon';
import MediaQuery from 'react-responsive';

import { PageLoading } from '../components';
Expand Down Expand Up @@ -66,6 +66,7 @@ class OrderHistoryPage extends React.Component {
return (
<Pagination
paginationLabel="pagination navigation"
className="pagination-margin"
pageCount={pageCount}
currentPage={currentPage}
onPageSelect={this.handlePageSelect}
Expand All @@ -87,32 +88,34 @@ class OrderHistoryPage extends React.Component {

renderOrdersTable() {
return (
<Table
className="order-history table-bordered"
<DataTable
data={this.getTableData()}
itemCount={this.props.count}
columns={[
{
label: this.props.intl.formatMessage(messages['ecommerce.order.history.table.column.items']),
key: 'description',
Header: this.props.intl.formatMessage(messages['ecommerce.order.history.table.column.items']),
accessor: 'description',
},
{
label: this.props.intl.formatMessage(messages['ecommerce.order.history.table.column.date.placed']),
key: 'datePlaced',
Header: this.props.intl.formatMessage(messages['ecommerce.order.history.table.column.date.placed']),
accessor: 'datePlaced',
},
{
label: this.props.intl.formatMessage(messages['ecommerce.order.history.table.column.total.cost']),
key: 'total',
Header: this.props.intl.formatMessage(messages['ecommerce.order.history.table.column.total.cost']),
accessor: 'total',
},
{
label: this.props.intl.formatMessage(messages['ecommerce.order.history.table.column.order.number']),
key: 'orderId',
Header: this.props.intl.formatMessage(messages['ecommerce.order.history.table.column.order.number']),
accessor: 'orderId',
},
{
label: this.props.intl.formatMessage(messages['ecommerce.order.history.table.column.order.details']),
key: 'receiptUrl',
Header: this.props.intl.formatMessage(messages['ecommerce.order.history.table.column.order.details']),
accessor: 'receiptUrl',
},
]}
/>
>
<DataTable.Table />
</DataTable>
);
}

Expand Down Expand Up @@ -224,6 +227,7 @@ OrderHistoryPage.propTypes = {
})),
})),
pageCount: PropTypes.number,
count: PropTypes.number,
currentPage: PropTypes.number,
loading: PropTypes.bool,
loadingError: PropTypes.string,
Expand All @@ -235,6 +239,7 @@ OrderHistoryPage.defaultProps = {
loadingError: null,
loading: false,
pageCount: 0,
count: 0,
currentPage: null,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ exports[`<OrderHistoryPage /> Renders correctly in various states renders orders
<div>
<nav
aria-label="pagination navigation"
className="pagination-default"
className="pagination-margin pagination-default"
>
<div
aria-atomic={true}
Expand Down
5 changes: 4 additions & 1 deletion src/order-history/_style.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.page__order-history {
table.order-history {
table {
thead th,
tbody td {
width: 4em;
Expand All @@ -11,3 +11,6 @@
}
}
}
.pagination-margin {
margin-top: 1rem;
}
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ exports[`<OrdersAndSubscriptions /> Renders correctly in various states renders
<div>
<nav
aria-label="pagination navigation"
className="pagination-default"
className="pagination-margin pagination-default"
>
<div
aria-atomic={true}
Expand Down