refactor copy code button

change pre component to server component
This commit is contained in:
DefectingCat
2023-12-26 11:05:06 +08:00
parent 40775b98f7
commit cf0c91edb6
7 changed files with 124 additions and 73 deletions

View File

@ -0,0 +1,25 @@
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;