Open roberthuarcaya opened 3 weeks ago
It's likely due to the missing href
on the second item, which makes it an expansion button and you can listen to event via onExpand
.
There is additional clean up improvement we can look into, but shouldn't stop you using the component correctly.
Thanks using onExpand solve the problem. I do not want to go to another website. I wanted to show a different part of the website when the user clicks on each tab. Thanks
Package name(s)
Core (@salt-ds/core)
Package version(s)
I am using the NavItem Now when I am clicking in one the items the clicking functionality does not work.
Dependencies: "@mds/react": "^12.4.0", "@salt-ds/core": "^1.11.0", "@salt-ds/icons": "^1.7.0", "@salt-ds/lab": "^1.0.0-alpha.20", "@salt-ds/theme": "^1.9.0",
Description
I am using the NavItem Now when I am clicking in one the items the clicking functionality does not work.
Steps to reproduce
Just make a Navegation item add some onClick function. I tried to use a console.log and the idea is that dispte I am clicking on the item the console.log does not display.
My code. Assume that the set function I am passing is a useState to display different outcome depndeing on the value of the state
//import React, { useState } from 'react';
// import { Flexbox , AppHeader, Logo, LogoImage, Tabstrip, Tooltray, Badge, Tab } from "@salt-ds/lab"; // import { Button, Text} from "@salt-ds/core"; //import { FaHome, FaBuilding, FaUniversity, FaUser, FaEnvelope } from 'react-icons/fa'; import {MessageIcon, SearchIcon, UserIcon, FilterIcon, UserGroupIcon, HomeIcon} from "@salt-ds/icons";
import React, {useState} from 'react'; import { Link, useLocation } from 'react-router-dom'; import './../AppNav/AppNav.css'; import logo from '../../LogoUtilities.png'; import {GridItem, GridLayout, StackLayout} from "@salt-ds/core"; import {NavigationItem} from "@salt-ds/core";
const AppNavLogin = ({setShowingTab, user}) => { const tabs = ["Home", "Tutorial and FAQ" ];
//const location = useLocation();
const [active, setActive] = useState(tabs[0]);
//const [selectedTab, handleTabSelection] = useTabSelection(); //remember to include the useTab elements in the return //borderBottom I changed the colours array for a fixed value //I deleted flexbox in the return
return (
); };
export default AppNavLogin;
Expected behavior
The onClick should tgrigger when we click the item
Operating system
Browser
Are you a JPMorgan Chase & Co. employee?