Files
DefectingCat.github.io/components/common/gist-code.tsx
DefectingCat cf0c91edb6 refactor copy code button
change pre component to server component
2023-12-26 11:05:06 +08:00

26 lines
562 B
TypeScript

import '@catppuccin/highlightjs/sass/catppuccin.variables.scss';
import GistsCode from 'components/pages/gists/gists-code';
import { getSignalGist } from 'lib/fetcher';
const GistCode = async ({ id }: { id: string }) => {
const gist = await getSignalGist(id);
if (!gist?.files) {
return <div>Error</div>;
}
return (
<div>
{Object.keys(gist.files).map((f) => (
<GistsCode
key={gist.files[f].raw_url}
file={gist.files[f]}
showFileName
/>
))}
</div>
);
};
export default GistCode;