saleor-dashboard/src/discounts/components/VoucherListPage/VoucherListPage.tsx

69 lines
1.9 KiB
TypeScript
Raw Normal View History

2019-06-19 14:40:52 +00:00
import Button from "@material-ui/core/Button";
import AddIcon from "@material-ui/icons/Add";
2019-08-09 10:26:22 +00:00
import React from "react";
import { FormattedMessage, useIntl } from "react-intl";
2019-06-19 14:40:52 +00:00
import Container from "@saleor/components/Container";
import PageHeader from "@saleor/components/PageHeader";
import { sectionNames } from "@saleor/intl";
2019-08-09 11:14:35 +00:00
import { ListActions, PageListProps } from "@saleor/types";
2019-06-19 14:40:52 +00:00
import { VoucherList_vouchers_edges_node } from "../../types/VoucherList";
import VoucherList from "../VoucherList";
export interface VoucherListPageProps extends PageListProps, ListActions {
defaultCurrency: string;
vouchers: VoucherList_vouchers_edges_node[];
}
const VoucherListPage: React.StatelessComponent<VoucherListPageProps> = ({
defaultCurrency,
disabled,
2019-08-09 11:14:35 +00:00
settings,
2019-06-19 14:40:52 +00:00
onAdd,
onNextPage,
onPreviousPage,
2019-08-09 11:14:35 +00:00
onUpdateListSettings,
2019-06-19 14:40:52 +00:00
onRowClick,
pageInfo,
vouchers,
isChecked,
selected,
toggle,
toggleAll,
toolbar
}) => {
const intl = useIntl();
return (
<Container>
<PageHeader title={intl.formatMessage(sectionNames.vouchers)}>
<Button onClick={onAdd} variant="contained" color="primary">
2019-09-05 13:33:50 +00:00
<FormattedMessage
defaultMessage="Create voucher"
description="button"
/>
<AddIcon />
</Button>
</PageHeader>
<VoucherList
defaultCurrency={defaultCurrency}
settings={settings}
disabled={disabled}
onNextPage={onNextPage}
onPreviousPage={onPreviousPage}
onUpdateListSettings={onUpdateListSettings}
onRowClick={onRowClick}
pageInfo={pageInfo}
vouchers={vouchers}
isChecked={isChecked}
selected={selected}
toggle={toggle}
toggleAll={toggleAll}
toolbar={toolbar}
/>
</Container>
);
};
2019-06-19 14:40:52 +00:00
VoucherListPage.displayName = "VoucherListPage";
export default VoucherListPage;