Comments (5)
Hi @christopherGdynia, thanks for reporting this issue - it really seems like the href
property is not drilled down to the child component: #363
from scale.
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.
from scale.
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 <a>
tags, so they won't directly work with client-side routing depending on the framework you're using (some work, some don't).
There is a way to work around this, by providing an onClick
prop in the mainNavigation data and handling the routing programmatically using the useRouter
hook from Next.js:
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?
from scale.
OK, fix is released: 3.0.0-beta.11
. Thanks again for raising this issue!
from scale.
Amazing, glad to hear.
from scale.
Related Issues (20)
- customizable link cells in data grids
- Error in light mode HOT 3
- Less unique files for Standalone-UMD builds HOT 2
- Header misses burger menu HOT 5
- Stacking modal dialog cause problem with scroll page HOT 7
- Scale Telekom Header doesn't close when not hovering above it anymore HOT 1
- scale-dropdown-select throws JS error if name attribute contains dot symbol. HOT 3
- [Tab Navigation] Programmatically select tabs
- @types/react mismatch
- ScaleDropdownSelect does not close when clicking on another one HOT 1
- scale-text-field not focus when invalid
- Tooltip placement is not correct
- Test automation limitations related to data-qa and hydrated classes
- Data Grid's Select Cell not reacting to "scaleEdit"-Event HOT 1
- Telekom header language switcher not visible
- Telekom
- Telekom Brand Header Profile Menu slots and/or event handlers
- Data grid html cell dropdown button has harcoded aria-labels and not possible add any text inside of the button
- Additional Tags Cell Controls
- Data grid html cell dropdown button has harcoded aria-labels and not possible add any text inside of the button
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scale.