spaCy/website/src/widgets/project.js

31 lines
898 B
JavaScript
Raw Normal View History

2020-07-05 17:11:16 +03:00
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'
2020-07-05 17:11:16 +03:00
const COMMAND = 'python -m spacy project clone'
2020-08-06 02:22:49 +03:00
export default function Project({ id, repo, children }) {
2020-07-05 17:11:16 +03:00
const repoArg = repo ? ` --repo ${repo}` : ''
const text = `${COMMAND} ${id}${repoArg}`
const url = `${repo || DEFAULT_REPO}/${id}`
const title = (
<>
2020-07-06 23:22:37 +03:00
Get started with a project template:{' '}
2020-07-05 17:11:16 +03:00
<Link to={url}>
<InlineCode>{id}</InlineCode>
</Link>
</>
)
return (
2020-07-06 23:22:37 +03:00
<Infobox title={title} emoji="🪐">
2020-07-05 17:11:16 +03:00
{children}
<CopyInput text={text} prefix="$" />
</Infobox>
)
}