Underline mdx links

Luke Karrys committed Oct 17, 2023 at 15:26 UTC 299503735be18a87dfdc2121149769fc6e963192
1 file changed +7 -6
src/mdx/index.js
+7 -6
@@ -1,15 +1,16 @@
1 import React from 'react'
2 -import {Box, Heading, themeGet, Text, Link, Octicon} from '@primer/react'
2 +import {Box, Heading, themeGet, Text, Link as PrimerLink, Octicon} from '@primer/react'
3 import styled from 'styled-components'
4 import {variant} from 'styled-system'
5 import {withPrefix} from 'gatsby'
6 import {LinkIcon} from '@primer/octicons-react'
7 import textContent from 'react-addons-text-content'
8 -import Code from './code'
9 -import NavHierarchy from './nav-hierarchy'
8 import {useSlugger} from '../layout'
9 import {HEADER_HEIGHT} from '../constants'
10
11 +export {default as Code} from './code'
12 +export {default as Index} from './nav-hierarchy'
13 +
14 const required = (prop, name) => {
15 if (!prop) {
16 throw new Error(`${name} prop is required`)
@@ -17,7 +18,7 @@ const required = (prop, name) => {
18 return prop
19 }
20
20 -export {Link, Code, NavHierarchy as Index}
21 +export const Link = props => <PrimerLink underline {...props} />
22
23 export const Pre = ({children}) => children
24
@@ -47,7 +48,7 @@ const Headings = {
48
49 return (
50 <StyledHeading id={id} {...props}>
50 - <Link
51 + <PrimerLink
52 href={`#${id}`}
53 aria-label={`${text} permalink`}
54 sx={{
@@ -68,7 +69,7 @@ const Headings = {
69 verticalAlign: 'middle !important',
70 }}
71 />
71 - </Link>
72 + </PrimerLink>
73 </StyledHeading>
74 )
75 },