saleor-dashboard/src/collections/components/CollectionListPage/CollectionListPage.tsx

46 lines
1.4 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 { CollectionList_collections_edges_node } from "../../types/CollectionList";
import CollectionList from "../CollectionList/CollectionList";
export interface CollectionListPageProps extends PageListProps, ListActions {
collections: CollectionList_collections_edges_node[];
}
const CollectionListPage: React.StatelessComponent<CollectionListPageProps> = ({
disabled,
onAdd,
...listProps
}) => {
const intl = useIntl();
return (
<Container>
<PageHeader title={intl.formatMessage(sectionNames.collections)}>
<Button
color="primary"
disabled={disabled}
variant="contained"
onClick={onAdd}
>
2019-08-22 16:25:55 +00:00
<FormattedMessage
2019-09-05 13:33:50 +00:00
defaultMessage="Create collection"
description="button"
2019-08-22 16:25:55 +00:00
/>
<AddIcon />
</Button>
</PageHeader>
<CollectionList disabled={disabled} {...listProps} />
</Container>
);
};
2019-06-19 14:40:52 +00:00
CollectionListPage.displayName = "CollectionListPage";
export default CollectionListPage;