I have an custom code component, and side nav bar, which has onMenuSelect will expose some properties like this in my studio host.
In registerComponent -
onMenuSelect: {
type: "eventHandler",
argTypes: [
{ name: "label", type: "string" },
{ name: "menuType", type: "string" },
{ name: "closed", type: "boolean" },
],
},
In the custom component ,
<SideNav
{...props}
width={props.width || "250px"}
menus={props.menus}
activeMenuType={menu.menuType}
open={menu.open}
activeMenu={menu.label}
onMenuSelect={(label: string, menuType: any, closed: any) => {
setMenu({ label, menuType, open: closed });
props.onMenuSelect?.(label, menuType, closed);
}}
/>
My issue : I want to run custom code, saying if the selected menu is dashboard then navigate to dashboard . etc.
I see that in the edit code popup there are options like $ctx , $globalActions , $queries , state , refs ect . But how do i tell plasmic to navigate to a new page ?
I have tried couple of things - $globalActions.navigate , window.location.href (obviously wrong) What is the right way to navigate using run custom code ?