-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MainNavigation hrefs aren't working in first level #362
Comments
Hi @christopherGdynia, thanks for your question. I'm assuming from #361 that you're using Next.js, right? The links inside the Scale header are plain There is a way to work around this, by providing an Something like this should work (haven't tested it myself): import { useRouter } from 'next/router'
function NavigationExample({ children, href }) {
const router = useRouter()
const handleClick = (e) => {
e.preventDefault()
router.push(href)
}
const mainNav = [
{ name: "Home", id: "home", href: "/", onClick: handleClick },
{ name: "About", id: "about", href: "/about", onClick: handleClick },
]
return (
<ScaleAppShell mainNavigation={mainNav}>
{/* ... */}
</ScaleAppShell>
)
} Would you be able to try this out? |
Hi @christopherGdynia, thanks for reporting this issue - it really seems like the |
OK, fix is released: |
Thanks for your answers :) I found this solution, based on your ideas @acstll const handleClick = (e: MouseEvent, href: string) => {
e.preventDefault();
router.push(href);
};
const navExample = {
name: "Search",
id: "Search41",
href: "#search",
onClick: (e: MouseEvent) => handleClick(e, "#search"),
icon: "action-search",
}; I will close #361 and link this post. |
Amazing, glad to hear. |
Hi again :D,
I am trying to setup the AppNavigation in the ScaleAppSchell component.
The goal:
I want to click on a first level element and want to perform a page switch.
What I have tried:
The component doesnt render the content of the href attribute as defined, but it renders javascript:void(0);
You can see the problem in your default example in storybook
The text was updated successfully, but these errors were encountered: