Skip to content

Commit 2f3b3e5

Browse files
committed
docs(Tabs): add gray tabs demo - pr comment changes (#6810)
1 parent 883839f commit 2f3b3e5

1 file changed

Lines changed: 5 additions & 14 deletions

File tree

packages/react-core/src/demos/examples/Tabs/GrayTabs.tsx

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,14 @@ import {
1919
import DashboardWrapper from '../../examples/DashboardWrapper';
2020

2121
export const GrayTabsDemo: React.FunctionComponent = () => {
22-
const [activeTabKey, setActiveTabKey] = React.useState(0);
23-
const [activeNestedTabKey, setActiveNestedTabKey] = React.useState(10);
22+
const [activeTabKey, setActiveTabKey] = React.useState<string | number>(0);
23+
const [activeNestedTabKey, setActiveNestedTabKey] = React.useState<string | number>(0);
2424

2525
// Toggle currently active tab
26-
const handleTabClick = (_: React.MouseEvent, tabIndex: string | number) => {
27-
if (typeof tabIndex === 'string') {
28-
return setActiveTabKey(parseInt(tabIndex));
29-
}
30-
return setActiveTabKey(tabIndex);
31-
};
26+
const handleTabClick = (_: React.MouseEvent, tabIndex: string | number) => setActiveTabKey(tabIndex);
27+
3228
// Toggle currently active nested tab
33-
const handleNestedTabClick = (_: React.MouseEvent, tabIndex: string | number) => {
34-
if (typeof tabIndex === 'string') {
35-
return setActiveNestedTabKey(parseInt(tabIndex));
36-
}
37-
return setActiveNestedTabKey(tabIndex);
38-
};
29+
const handleNestedTabClick = (_: React.MouseEvent, tabIndex: string | number) => setActiveNestedTabKey(tabIndex);
3930

4031
const tabContent = (
4132
<Grid hasGutter>

0 commit comments

Comments
 (0)