Comments (3)
@acstll thank you for response,
actually for footerNavigation
i was able to work around this using onClick
prop
example link to playground i was able to intercept click event and trigger custom navigation function.
{
name: "Terms and conditions",
id: "Terms and conditions",
href: "/user",
icon: "user-file-user",
onClick: (e) => {
e.preventDefault();
history.push(e.currentTarget.pathname);
},
},
will try mainNavigation solution you provided -although its a bit verbose but i will try to look in source code for full example- and let you know
thank you again
from scale.
You're very welcome.
I'm glad the onClick
prop works for you. onClick
is also available in the for mainNavigation
attribute in the header, so maybe you'd want to use it too. I would recommend exploring the slots/custom markup option anyways :)
from scale.
Thank you @alzalabany for opening this issue.
Currently it's not possible to add custom elements in neither mainNavigation
for the header nor footerNavigation
for the footer.
The header however allows you to add custom markup via slots. The 3 slots you could use for this would be:
menu-main
for the main menu on the left hand sidemenu-mobile
for the mobile version of the main menumenu-icon
for the right hand side
When you use these slots, you are free to structure your menu in any way you like, including other React components like the router Link
you mention.
Here's an example:
<scale-app-shell>
<scale-app-header slot="header">
<div slot="menu-main">
<scale-menu-flyout>
<button slot="trigger">Menu</button>
<scale-menu-flyout-list>
<scale-menu-flyout-item>
<!-- replace with your own React component -->
<a href="#1">Link 1</a>
</scale-menu-flyout-item>
<scale-menu-flyout-item>
<a href="#2">Link 2</a>
</scale-menu-flyout-item>
</scale-menu-flyout-list>
</scale-menu-flyout>
</div>
<div slot="menu-mobile">
<!-- "left side" content for mobile -->
</div>
<div slot="menu-icon">
<!-- right side, your code here -->
</div>
</scale-app-header>
</scale-app-shell>
If you need more info regarding slots (they work a bit different than in JS frameworks), I suggest you check these pages:
- https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_templates_and_slots#adding_flexibility_with_slots
- https://javascript.info/slots-composition
The "as
prop" pattern idea is indeed interesting but not feasible, since you'll be passing a React component into a web component, and the web component wouldn't know how to deal with a virtual DOM node.
The ScaleLink
component is a light wrapper around an a
tag. So I believe it's better in this case for you to create a React component that wraps the router's Link
and add some Scale styles using the Scale's CSS variables.
Let me know what you think.
from scale.
Related Issues (20)
- [Tab Navigation]: Programatically enabling tab does not work HOT 6
- Scale-Table: sorting indicator not added when adding new column
- Problems with the Installation of telekom-scale with angular HOT 9
- Text Field inner colors remain inverted after autofill HOT 1
- NextJS with 'use client', StaticSiteGeneration and output: export HOT 1
- Error in icon navigation after scale update HOT 1
- 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
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.