spaCy/website/src/widgets/project.js
2020-09-10 13:04:16 +02:00

31 lines
898 B
JavaScript

import React from 'react'
import CopyInput from '../components/copy'
import Infobox from '../components/infobox'
import Link from '../components/link'
import { InlineCode } from '../components/code'
// TODO: move to meta?
const DEFAULT_REPO = 'https://github.com/explosion/projects/tree/v3'
const COMMAND = 'python -m spacy project clone'
export default function Project({ id, repo, children }) {
const repoArg = repo ? ` --repo ${repo}` : ''
const text = `${COMMAND} ${id}${repoArg}`
const url = `${repo || DEFAULT_REPO}/${id}`
const title = (
<>
Get started with a project template:{' '}
<Link to={url}>
<InlineCode>{id}</InlineCode>
</Link>
</>
)
return (
<Infobox title={title} emoji="🪐">
{children}
<CopyInput text={text} prefix="$" />
</Infobox>
)
}