Skip to content
Merged
Show file tree
Hide file tree
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
11 changes: 8 additions & 3 deletions src/components/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,19 @@ const GatsbyLinkWithoutSxProps = React.forwardRef(function GatsbyLinkWithoutSxPr
return <GatsbyLink ref={ref} {...omit(props, 'sx', 'underline', 'hoverColor', 'muted')} />
})

const Link = React.forwardRef(function Link({to, href, ...props}, ref) {
const Link = React.forwardRef(function Link({to, href, showUnderline = false, sx, ...props}, ref) {
const localPath = getLocalPath(href)

const linkStyles = {
...sx,
...(showUnderline && {textDecoration: 'underline'}),
}

if (to || localPath !== null) {
return <PrimerLink ref={ref} as={GatsbyLinkWithoutSxProps} to={to || localPath} {...props} />
return <PrimerLink ref={ref} as={GatsbyLinkWithoutSxProps} to={to || localPath} sx={linkStyles} {...props} />
}

return <PrimerLink ref={ref} href={href} {...props} />
return <PrimerLink ref={ref} href={href} sx={linkStyles} {...props} />
})

export const LinkNoUnderline = React.forwardRef(function LinkNoUnderline({sx, ...props}, ref) {
Expand Down
10 changes: 8 additions & 2 deletions src/components/page-footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,14 @@ const Contributors = ({contributors = [], latestCommit}) => {
</Box>
{latestCommit ? (
<Text sx={{fontSize: 1, mt: 1}}>
Last edited by <Link href={`https://github.com/${latestCommit.login}`}>{latestCommit.login}</Link> on{' '}
<Link href={latestCommit.url}>{format(new Date(latestCommit.date))}</Link>
Last edited by{' '}
<Link href={`https://github.com/${latestCommit.login}`} showUnderline={true}>
{latestCommit.login}
</Link>{' '}
on{' '}
<Link href={latestCommit.url} showUnderline={true}>
{format(new Date(latestCommit.date))}
</Link>
</Text>
) : null}
</>
Expand Down
9 changes: 8 additions & 1 deletion src/components/table-of-contents.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@ const TableOfContentsItems = ({items, depth}) => (
)

const TableOfContents = ({'aria-labelledby': ariaLabelledBy, items, depth = 1, ...props}) => (
<NavList aria-labelledby={ariaLabelledBy} {...props}>
<NavList
aria-labelledby={ariaLabelledBy}
{...props}
sx={{
textDecoration: 'underline',
...props.sx,
}}
>
<TableOfContentsItems items={items} depth={depth} />
</NavList>
)
Expand Down
Loading