popular-magentaP
Refine3y ago
21 replies
popular-magenta

How to add a menu item in Sider with "create" action?

I need a confirmation of the fact that resource in <Refine> will only create "list" menu item correct? What would be the right way if I want to add custom menu item, with custom positioned and still have the CanAccess functionalities?
Right now I have this file:

import { AppstoreOutlined, MailOutlined, SettingOutlined } from '@ant-design/icons';
import type { MenuProps } from 'antd';

type MenuItem = Required<MenuProps>['items'][number];

export const customMenuItems: MenuItem[] = [
{
label: "Navigation One",
key: "1",
icon: <MailOutlined />,
children: []
}
];

And in my sider.tsx (which I created using Swizzle ThemedLayout for antd):

const renderMenu = () => {
return (
<Menu
selectedKeys={selectedKey ? [selectedKey] : []}
defaultOpenKeys={defaultOpenKeys}
mode="inline"
items={customMenuItems}
>
{logout}
</Menu>
);
};

It works with showing the item I added, but I know for sure renderTreeView with CanAccess (automatically generated using Swizzle) are not being implemented for my menu item
Was this page helpful?