saleor-dashboard/src/customers/components/CustomerListPage/CustomerListPage.tsx

50 lines
1.4 KiB
TypeScript
Raw Normal View History

2019-06-19 14:40:52 +00:00
import Button from "@material-ui/core/Button";
2019-09-10 12:11:47 +00:00
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 { ListCustomers_customers_edges_node } from "../../types/ListCustomers";
import CustomerList from "../CustomerList/CustomerList";
export interface CustomerListPageProps extends PageListProps, ListActions {
customers: ListCustomers_customers_edges_node[];
}
const CustomerListPage: React.StatelessComponent<CustomerListPageProps> = ({
customers,
disabled,
onAdd,
...customerListProps
}) => {
const intl = useIntl();
return (
<Container>
<PageHeader title={intl.formatMessage(sectionNames.customers)}>
<Button
color="primary"
variant="contained"
disabled={disabled}
onClick={onAdd}
>
<FormattedMessage
defaultMessage="Add customer"
description="button"
/>
</Button>
</PageHeader>
<CustomerList
customers={customers}
2019-06-19 14:40:52 +00:00
disabled={disabled}
{...customerListProps}
/>
</Container>
);
};
2019-06-19 14:40:52 +00:00
CustomerListPage.displayName = "CustomerListPage";
export default CustomerListPage;