Skip to content

Commit 53858c3

Browse files
committed
Add self-service tab to navigation
1 parent 3c37101 commit 53858c3

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

src/components/Tab/index.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ const Tab = ({
2828
selectTab(3)
2929
}
3030

31+
const onSelfServiceClick = () => {
32+
if (currentTab === 4) {
33+
return
34+
}
35+
selectTab(4)
36+
}
37+
3138
const tabComponent = (
3239
<ul className={styles.challengeTab}>
3340
<li
@@ -72,6 +79,20 @@ const Tab = ({
7279
>
7380
Users
7481
</li>
82+
<li
83+
key='tab-item-self-service'
84+
className={cn(styles.item, { [styles.active]: currentTab === 4 })}
85+
onClick={onSelfServiceClick}
86+
onKeyDown={e => {
87+
if (e.key !== 'Enter') {
88+
return
89+
}
90+
onSelfServiceClick()
91+
}}
92+
role='presentation'
93+
>
94+
Self-Service
95+
</li>
7596
</ul>
7697
)
7798

src/containers/Tab/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ class TabContainer extends Component {
4141
this.setState({ currentTab: 2 })
4242
} else if (nextProps.history.location.pathname === '/users') {
4343
this.setState({ currentTab: 3 })
44+
} else if (nextProps.history.location.pathname === '/self-service') {
45+
this.setState({ currentTab: 4 })
4446
} else {
4547
this.setState({ currentTab: 0 })
4648
}
@@ -85,6 +87,9 @@ class TabContainer extends Component {
8587
} else if (tab === 3) {
8688
history.push('/users')
8789
this.setState({ currentTab: 3 })
90+
} else if (tab === 4) {
91+
history.push('/self-service')
92+
this.setState({ currentTab: 4 })
8893
}
8994

9095
resetSidebarActiveParams()

0 commit comments

Comments
 (0)