File tree Expand file tree Collapse file tree 1 file changed +14
-21
lines changed
apps/create-hypergraph/template-vite-react/src/components Expand file tree Collapse file tree 1 file changed +14
-21
lines changed Original file line number Diff line number Diff line change 1- import { Link , useRouter } from '@tanstack/react-router' ;
1+ import { Link } from '@tanstack/react-router' ;
22import { clsx } from 'clsx' ;
33
44type Tab = {
@@ -14,29 +14,22 @@ const tabs: Tab[] = [
1414] ;
1515
1616export function ExploreTabs ( ) {
17- const router = useRouter ( ) ;
18- const pathname = router . state . location . pathname ?? '' ;
19-
2017 return (
2118 < div className = "w-full flex justify-center" >
2219 < div className = "inline-flex rounded-lg border bg-background p-1" >
23- { tabs . map ( ( tab ) => {
24- const isActive = pathname . startsWith ( tab . to ) ;
25- return (
26- < Link
27- key = { tab . to }
28- to = { tab . to }
29- className = { clsx (
30- 'px-4 py-2 text-sm rounded-md transition-colors' ,
31- isActive
32- ? 'bg-primary text-primary-foreground'
33- : 'text-foreground hover:bg-accent hover:text-accent-foreground' ,
34- ) }
35- >
36- { tab . label }
37- </ Link >
38- ) ;
39- } ) }
20+ { tabs . map ( ( tab ) => (
21+ < Link
22+ key = { tab . to }
23+ to = { tab . to }
24+ activeOptions = { { exact : false } }
25+ activeProps = { { className : 'bg-primary text-primary-foreground' } }
26+ className = { clsx (
27+ 'px-4 py-2 text-sm rounded-md transition-colors text-foreground hover:bg-accent hover:text-accent-foreground' ,
28+ ) }
29+ >
30+ { tab . label }
31+ </ Link >
32+ ) ) }
4033 </ div >
4134 </ div >
4235 ) ;
You can’t perform that action at this time.
0 commit comments