Files
hatchet/frontend/docs/components/code/GithubSnippet.tsx
T
Gabe Ruttner c88a18180a docs: git driven snips -- on failure page (#1043)
* feat: universal tabs

* fix: consistent tab naming

* feat: paths

* wip: chunk parser

* wip: dynamic snips

* wip: components

* docs: annotated go

* docs: improved annotations

* chore: fix

* feat: on-failure

* todo: switch branch to main

* chore: lint

* chore: lint

* fix: resolved theme

* cache

* fix: theme again...

* todo list

* docs: shadcn

* docs: code example uses shadcn

* fix: build

* python note

* chore: lint

* chore: swap main

* feat: local story

* fix: is dev

* revert the change that broke vercel

* fix: redirect?

* feat: seo title
2024-11-18 15:50:51 -08:00

24 lines
519 B
TypeScript

import React from 'react'
import { useData } from 'nextra/data'
import { CodeBlock } from './CodeBlock'
import { RepoProps, Src } from './codeData'
interface GithubSnippetProps {
src: RepoProps
target: string
}
export const GithubSnippet = ({ src, target }: GithubSnippetProps) => {
const { contents } = useData()
const snippet = contents.find(c => c.rawUrl.endsWith(src.path)) as Src
if (!snippet) {
return null
}
return <CodeBlock source={{
...src,
...snippet,
}} target={target} />
}