FunctionsNav.tsx30 lines · main
1import { useRouter } from 'next/router'
2import { Tabs } from 'ui'
3
4const FunctionsNav = ({ item }: any) => {
5 const router = useRouter()
6 const activeRoute = router.pathname.split('/')[5]
7 const { ref } = router.query
8
9 return (
10 <Tabs
11 defaultActiveId="1"
12 type="underlined"
13 size="medium"
14 baseClassNames="space-y-0!"
15 activeId={!activeRoute ? 'overview' : activeRoute}
16 onChange={(e: string) => {
17 if (item?.slug) {
18 router.push(`/project/${ref}/functions/${item.slug}/${e === 'overview' ? '' : e}`)
19 }
20 }}
21 >
22 <Tabs.Panel id="overview" label="Overview" />
23 <Tabs.Panel id="invocations" label="Invocations" />
24 <Tabs.Panel id="logs" label="Logs" />
25 <Tabs.Panel id="details" label="Details" />
26 </Tabs>
27 )
28}
29
30export default FunctionsNav