spaCy/website/src/widgets/project.js

36 lines
954 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'
2020-09-20 18:44:58 +03:00
import { projectsRepo } from '../components/util'
2020-07-05 17:11:16 +03:00
const COMMAND = 'python -m spacy project clone'
2020-09-20 18:44:58 +03:00
export default function Project({
title = 'Get started with a project template',
id,
repo,
children,
}) {
2020-07-05 17:11:16 +03:00
const repoArg = repo ? ` --repo ${repo}` : ''
const text = `${COMMAND} ${id}${repoArg}`
2020-09-23 10:43:51 +03:00
const defaultRepo = `https://github.com/${projectsRepo}`
const url = `${repo || defaultRepo}/${id}`
2020-09-20 18:44:58 +03:00
const header = (
2020-07-05 17:11:16 +03:00
<>
2020-09-20 18:44:58 +03:00
{title}:{' '}
2020-07-05 17:11:16 +03:00
<Link to={url}>
<InlineCode>{id}</InlineCode>
</Link>
</>
)
return (
2020-09-20 18:44:58 +03:00
<Infobox title={header} emoji="🪐">
2020-07-05 17:11:16 +03:00
{children}
<CopyInput text={text} prefix="$" />
</Infobox>
)
}