saleor-dashboard/src/pages/components/PageListPage/PageListPage.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";
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 AppHeader from "@saleor/components/AppHeader";
import Container from "@saleor/components/Container";
import PageHeader from "@saleor/components/PageHeader";
import { sectionNames } from "@saleor/intl";
2019-12-17 17:13:56 +00:00
import { ListActions, PageListProps, SortPage } from "@saleor/types";
import { PageListUrlSortField } from "@saleor/pages/urls";
2019-06-19 14:40:52 +00:00
import { PageList_pages_edges_node } from "../../types/PageList";
2019-12-17 17:13:56 +00:00
import PageList from "../PageList";
2019-06-19 14:40:52 +00:00
2019-12-17 17:13:56 +00:00
export interface PageListPageProps
extends PageListProps,
ListActions,
SortPage<PageListUrlSortField> {
2019-06-19 14:40:52 +00:00
pages: PageList_pages_edges_node[];
onBack: () => void;
}
const PageListPage: React.FC<PageListPageProps> = ({
2019-06-19 14:40:52 +00:00
onAdd,
onBack,
2019-12-17 17:13:56 +00:00
...listProps
}) => {
const intl = useIntl();
return (
<Container>
<AppHeader onBack={onBack}>
{intl.formatMessage(sectionNames.configuration)}
</AppHeader>
<PageHeader title={intl.formatMessage(sectionNames.pages)}>
2019-12-17 17:13:56 +00:00
<Button onClick={onAdd} variant="contained" color="primary">
2019-09-05 13:33:50 +00:00
<FormattedMessage defaultMessage="Create page" description="button" />
</Button>
</PageHeader>
2019-12-17 17:13:56 +00:00
<PageList {...listProps} />
</Container>
);
};
2019-06-19 14:40:52 +00:00
PageListPage.displayName = "PageListPage";
export default PageListPage;