mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2026-04-29 15:37:48 +00:00
23 lines
775 B
TypeScript
23 lines
775 B
TypeScript
// Create a link into the source code repository for this project.
|
|
// This is supposed to adjust so that PR builds use the branch+fork of the PR,
|
|
// but that part wasn't implemented for Redocly builds.
|
|
|
|
import * as React from 'react'
|
|
import dynamicReact from '@markdoc/markdoc/dist/react'
|
|
import { Link } from '@redocly/theme/components/Link/Link'
|
|
|
|
export default function RepoLink(props: {
|
|
children: React.ReactNode
|
|
path: string
|
|
github_fork: string
|
|
github_branch: string
|
|
}) {
|
|
const treeblob = props.path.indexOf(".") >= 0 ? "blob/" : "tree/"
|
|
const sep = props.github_fork[-1] == "/" ? "" : "/"
|
|
const href = props.github_fork+sep+treeblob+props.github_branch+"/"+props.path
|
|
|
|
return (
|
|
<Link to={href}>{dynamicReact(props.children, React, {})}</Link>
|
|
)
|
|
}
|