mirror of
https://github.com/primer/css.git
synced 2024-12-01 04:21:12 +03:00
14 lines
385 B
JavaScript
14 lines
385 B
JavaScript
|
import React from 'react'
|
||
|
import Link from './Link'
|
||
|
import {rootPage} from './utils'
|
||
|
|
||
|
export default function NodeLink(props) {
|
||
|
const {href, children: content} = props
|
||
|
if (content) {
|
||
|
return <Link {...props} />
|
||
|
}
|
||
|
const node = rootPage.first(node => node.path === href)
|
||
|
const children = (node ? node.meta.title : null) || href
|
||
|
return <Link {...props}>{children}</Link>
|
||
|
}
|