@@ -26,7 +26,7 @@ import {
2626 Unauthenticated ,
2727 AuthLoading ,
2828} from '~/components/AuthComponents'
29- import { libraries } from '~/libraries'
29+ import { libraries , findLibrary } from '~/libraries'
3030import { useCapabilities } from '~/hooks/useCapabilities'
3131import { useClickOutside } from '~/hooks/useClickOutside'
3232import { GithubIcon } from '~/components/icons/GithubIcon'
@@ -40,9 +40,15 @@ export function Navbar({ children }: { children: React.ReactNode }) {
4040 const matches = useMatches ( )
4141 const capabilities = useCapabilities ( )
4242
43- const Title =
44- [ ...matches ] . reverse ( ) . find ( ( m ) => m . staticData . Title ) ?. staticData . Title ??
45- null
43+ const { Title, library } = React . useMemo ( ( ) => {
44+ const match = [ ...matches ] . reverse ( ) . find ( ( m ) => m . staticData . Title )
45+ const libraryId = match ?. params ?. libraryId
46+
47+ return {
48+ Title : match ?. staticData . Title ?? null ,
49+ library : libraryId ? findLibrary ( libraryId ) : null ,
50+ }
51+ } , [ matches ] )
4652
4753 const canAdmin = capabilities . includes ( 'admin' )
4854
@@ -133,34 +139,30 @@ export function Navbar({ children }: { children: React.ReactNode }) {
133139 )
134140
135141 const socialLinks = (
136- < div className = "flex items-center" >
142+ < div className = "flex items-center [&_a]:p-1.5 [&_a]:opacity-50 [&_a:hover]:opacity-100 [&_a]:transition-opacity [&_svg]:text-sm " >
137143 < a
138- href = "https://x.com/tan_stack"
139- className = "p-1.5 opacity-50 hover:opacity-100 transition-opacity"
140- aria-label = "Follow TanStack on X.com"
144+ href = { `https://github.com/${ library ?. repo ?? 'tanstack' } ` }
145+ aria-label = { `Follow ${ library ?. name ?? 'TanStack' } on GitHub` }
141146 >
142- < BrandXIcon className = "text-sm" />
147+ < GithubIcon />
148+ </ a >
149+ < a href = "https://x.com/tan_stack" aria-label = "Follow TanStack on X.com" >
150+ < BrandXIcon />
143151 </ a >
144152 < a
145153 href = "https://bsky.app/profile/tanstack.com"
146- className = "p-1.5 opacity-50 hover:opacity-100 transition-opacity"
147- aria-label = "Follow TanStack on Bluesky"
154+ aria-label = "Follow TanStack on Besky"
148155 >
149- < BSkyIcon className = "text-sm" />
156+ < BSkyIcon />
150157 </ a >
151158 < a
152159 href = "https://instagram.com/tan_stack"
153- className = "p-1.5 opacity-50 hover:opacity-100 transition-opacity"
154160 aria-label = "Follow TanStack on Instagram"
155161 >
156- < InstagramIcon className = "text-sm" />
162+ < InstagramIcon />
157163 </ a >
158- < a
159- href = "https://tlinz.com/discord"
160- className = "p-1.5 opacity-50 hover:opacity-100 transition-opacity"
161- aria-label = "Join TanStack Discord"
162- >
163- < DiscordIcon className = "text-sm" />
164+ < a href = "https://tlinz.com/discord" aria-label = "Join TanStack Discord" >
165+ < DiscordIcon />
164166 </ a >
165167 </ div >
166168 )
0 commit comments