1
0
mirror of synced 2025-12-23 11:54:18 -05:00

adding copy code to code samples in rest docs (#26043)

This commit is contained in:
Grace Park
2022-03-09 09:41:48 -08:00
committed by GitHub
parent feb3f25f02
commit 28e81ba93b
2 changed files with 56 additions and 24 deletions

View File

@@ -18,22 +18,10 @@ export function RestCodeSamples({ slug, xCodeSamples }: Props) {
{xCodeSamples.map((sample, index) => {
const sampleElements: JSX.Element[] = []
if (sample.lang !== 'Ruby') {
sampleElements.push(
sample.lang === 'JavaScript' ? (
<h5 key={`${sample.lang}-${index}`}>
{sample.lang} (
<a className="text-underline" href="https://github.com/octokit/core.js#readme">
@octokit/core.js
</a>
)
</h5>
) : (
<h5 key={`${sample.lang}-${index}`}>{sample.lang}</h5>
)
)
sampleElements.push(
<CodeBlock
key={sample.lang + index}
headingLang={sample.lang}
codeBlock={sample.source}
highlight={sample.lang === 'JavaScript' ? 'javascript' : 'curl'}
></CodeBlock>