mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2026-01-08 17:59:43 -06:00
* patch: next * patch: axios * nextra 2 -> 3 * final fixes for docs * fix: v0-docs * chore: update dependencies * chore: update fe * chore: final fixes * fix: vite * fix: generate * chore: generate * chore: generate * lint
29 lines
571 B
TypeScript
29 lines
571 B
TypeScript
import React from "react";
|
|
import { useData } from "nextra/hooks";
|
|
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}
|
|
/>
|
|
);
|
|
};
|