mirror of
https://github.com/r-freeman/portfolio.git
synced 2024-11-25 02:05:42 +00:00
Add hover state to anchor links
All checks were successful
Build And Publish / BuildAndPublish (push) Successful in 2m38s
All checks were successful
Build And Publish / BuildAndPublish (push) Successful in 2m38s
This commit is contained in:
parent
19306831ec
commit
a8385c50d9
@ -1,3 +1,4 @@
|
||||
// @ts-nocheck
|
||||
import type {MDXComponents} from 'mdx/types'
|
||||
import {createSlug} from './lib/createSlug'
|
||||
import Link from 'next/link'
|
||||
@ -11,8 +12,11 @@ import Link from 'next/link'
|
||||
export function useMDXComponents(components: MDXComponents): MDXComponents {
|
||||
return {
|
||||
h2: ({children}) =>
|
||||
// @ts-ignore TS18049
|
||||
<h2 id={createSlug(children.toString())}>{children}<Link className='ml-1' href={`#${createSlug(children.toString())}`} name="anchor" scroll={false}>#</Link></h2>,
|
||||
<h2 id={createSlug(children.toString())}
|
||||
className='group'>{children}
|
||||
<Link className='ml-1 group-hover:opacity-100 opacity-0 transition-opacity ease-in'
|
||||
href={`#${createSlug(children.toString())}`}
|
||||
name="anchor">#</Link></h2>,
|
||||
// Allows customizing built-in components, e.g. to add styling.
|
||||
// h1: ({ children }) => <h1 style={{ fontSize: "100px" }}>{children}</h1>,
|
||||
...components,
|
||||
|
Loading…
Reference in New Issue
Block a user