mirror of
https://github.com/DefectingCat/DefectingCat.github.io
synced 2025-07-16 01:01:38 +00:00
refactor copy code button
change pre component to server component
This commit is contained in:
25
components/common/gist-code.tsx
Normal file
25
components/common/gist-code.tsx
Normal 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;
|
Reference in New Issue
Block a user