add gist loading page

format code
This commit is contained in:
DefectingCat
2023-08-14 13:36:15 +08:00
parent d6447c6a8e
commit 32d8d48514
44 changed files with 142 additions and 107 deletions

View File

@ -45,7 +45,7 @@ export const getGists = cache(async (page = 1, perPage = 10) => {
const text = l.match(relMatch)?.[1] as PageKeys;
if (!text) return;
pageSize[text] = new URLSearchParams(
l.match(linkMatch)?.[1].split('?')[1]
l.match(linkMatch)?.[1].split('?')[1],
).get('page');
});
@ -68,9 +68,9 @@ export const getGists = cache(async (page = 1, perPage = 10) => {
} catch (err) {
console.log(err);
}
})
}),
);
})
}),
);
return {
@ -127,7 +127,7 @@ export const getSignalGist = cache(async (id: string) => {
content: '',
};
target.content = await fetch(url).then((res) => res.text());
})
}),
);
return data;

View File

@ -13,7 +13,7 @@ const useInView = () => {
observer.unobserve(ref.current);
});
},
[]
[],
);
useEffect(() => {

View File

@ -13,7 +13,7 @@ const useRouterLoading = () => {
(url: string) => {
url !== router.pathname ? setLoading(true) : setLoading(false);
},
[router.pathname]
[router.pathname],
);
const handleComplete = useCallback(() => {
setLoading(false);

View File

@ -14,7 +14,7 @@ export const dataPath = 'content/posts';
const readFileMeta = async (filename: string) => {
const markdownWithMeta = await fs.readFile(
path.join(dataPath, filename),
'utf-8'
'utf-8',
);
const slug = filename.replace(/\.mdx$/, '');
const { data: meta } = matter(markdownWithMeta);