Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions src/routes/_library/$libraryId/route.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Link, createFileRoute } from '@tanstack/react-router'
import { notFound, Outlet, useParams } from '@tanstack/react-router'
import { notFound, Outlet } from '@tanstack/react-router'
import { Scarf } from '~/components/Scarf'
import { findLibrary, LibraryId } from '~/libraries'
import { seo } from '~/utils/seo'
Expand Down Expand Up @@ -58,30 +58,21 @@ export const Route = createFileRoute('/_library/$libraryId')({
staticData: {
Title: () => {
const { libraryId } = Route.useParams()
const { version } = useParams({ strict: false })
const library = findLibrary(libraryId)

if (!library) {
return null
}

const libraryName = library.name.replace('TanStack ', '')
const resolvedVersion =
version === 'latest' ? library.latestVersion : version!
const gradientText = `inline-block text-transparent bg-clip-text bg-linear-to-r ${library.colorFrom} ${library.colorTo}`
return (
<Link
to={`/$libraryId`}
params={{ libraryId }}
className="relative whitespace-nowrap"
className="whitespace-nowrap"
>
<span className={`${gradientText}`}>{libraryName}</span>{' '}
<span className="text-sm absolute right-0 top-0 font-normal normal-case">
{resolvedVersion}
</span>
<span className="text-sm opacity-0 normal-case">
{resolvedVersion}
</span>
<span className={gradientText}>{libraryName}</span>
</Link>
)
},
Expand Down
Loading