mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2026-05-06 18:09:49 -05:00
c88a18180a
* 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
24 lines
519 B
TypeScript
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} />
|
|
}
|