Skip to content

Commit

Permalink
fix: resolves #157
Browse files Browse the repository at this point in the history
  • Loading branch information
jxom committed May 12, 2024
1 parent d9a474a commit 0c3193e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .changeset/silly-buttons-prove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"vocs": patch
---

Fixed outline slug links when a `basePath` exists.
14 changes: 4 additions & 10 deletions src/app/components/mdx/Autolink.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
import { clsx } from 'clsx'
import { type AnchorHTMLAttributes, type DetailedHTMLProps } from 'react'
import { Link } from 'react-router-dom'

import { useLocation } from 'react-router-dom'
import * as styles from './Autolink.css.js'

export function Autolink(
props: DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>,
props: Omit<DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, 'ref'>,
) {
const { pathname } = useLocation()
return (
<a
{...props}
className={clsx(props.className, styles.root)}
href={`${pathname}${props.href}`}
/>
)
if (!props.href) return null
return <Link {...props} className={clsx(props.className, styles.root)} to={props.href} />
}

0 comments on commit 0c3193e

Please sign in to comment.