2019-06-19 14:40:52 +00:00
|
|
|
import Container from "@saleor/components/Container";
|
|
|
|
import PageHeader from "@saleor/components/PageHeader";
|
2019-08-26 14:51:47 +00:00
|
|
|
import { sectionNames } from "@saleor/intl";
|
2022-01-28 12:34:20 +00:00
|
|
|
import { Backlink, Button } from "@saleor/macaw-ui";
|
2019-12-17 17:13:56 +00:00
|
|
|
import { MenuListUrlSortField } from "@saleor/navigation/urls";
|
2020-05-14 09:30:32 +00:00
|
|
|
import { ListActions, PageListProps, SortPage } from "@saleor/types";
|
|
|
|
import React from "react";
|
|
|
|
import { FormattedMessage, useIntl } from "react-intl";
|
|
|
|
|
2019-06-19 14:40:52 +00:00
|
|
|
import { MenuList_menus_edges_node } from "../../types/MenuList";
|
|
|
|
import MenuList from "../MenuList";
|
|
|
|
|
2019-12-17 17:13:56 +00:00
|
|
|
export interface MenuListPageProps
|
|
|
|
extends PageListProps,
|
|
|
|
ListActions,
|
|
|
|
SortPage<MenuListUrlSortField> {
|
2019-06-19 14:40:52 +00:00
|
|
|
menus: MenuList_menus_edges_node[];
|
|
|
|
onBack: () => void;
|
|
|
|
onDelete: (id: string) => void;
|
|
|
|
}
|
|
|
|
|
2019-11-07 11:34:54 +00:00
|
|
|
const MenuListPage: React.FC<MenuListPageProps> = ({
|
2019-06-19 14:40:52 +00:00
|
|
|
onAdd,
|
|
|
|
onBack,
|
|
|
|
...listProps
|
2019-08-26 14:51:47 +00:00
|
|
|
}) => {
|
|
|
|
const intl = useIntl();
|
|
|
|
return (
|
|
|
|
<Container>
|
2021-07-21 08:59:52 +00:00
|
|
|
<Backlink onClick={onBack}>
|
2019-08-26 14:51:47 +00:00
|
|
|
{intl.formatMessage(sectionNames.configuration)}
|
2021-07-21 08:59:52 +00:00
|
|
|
</Backlink>
|
2019-08-26 14:51:47 +00:00
|
|
|
<PageHeader title={intl.formatMessage(sectionNames.navigation)}>
|
2022-01-28 12:34:20 +00:00
|
|
|
<Button variant="primary" onClick={onAdd} data-test-id="addMenu">
|
2019-08-26 14:51:47 +00:00
|
|
|
<FormattedMessage
|
2019-09-05 13:33:50 +00:00
|
|
|
defaultMessage="Create Menu"
|
2019-08-26 14:51:47 +00:00
|
|
|
description="button"
|
|
|
|
id="menuListPageAddMenu"
|
|
|
|
/>
|
|
|
|
</Button>
|
|
|
|
</PageHeader>
|
2019-12-17 17:13:56 +00:00
|
|
|
<MenuList {...listProps} />
|
2019-08-26 14:51:47 +00:00
|
|
|
</Container>
|
|
|
|
);
|
|
|
|
};
|
2019-06-19 14:40:52 +00:00
|
|
|
MenuListPage.displayName = "MenuListPage";
|
|
|
|
export default MenuListPage;
|