mirror of
https://litchi.icu/ngc2207/judge4c-demo.git
synced 2025-05-18 19:47:15 +00:00
feat: 更新单个代码片段展示页面,添加编辑和删除按钮,并优化展示样式
This commit is contained in:
parent
8b251a3ea1
commit
e4d639e77c
@ -8,7 +8,7 @@ interface SnippetShowPageProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default async function SnippetShowPage(props: SnippetShowPageProps) {
|
export default async function SnippetShowPage(props: SnippetShowPageProps) {
|
||||||
await new Promise((r) => setTimeout(r, 2000));
|
// await new Promise((r) => setTimeout(r, 2000));
|
||||||
|
|
||||||
const params = await props.params;
|
const params = await props.params;
|
||||||
const snippet = await db.snippet.findFirst({
|
const snippet = await db.snippet.findFirst({
|
||||||
@ -21,5 +21,18 @@ export default async function SnippetShowPage(props: SnippetShowPageProps) {
|
|||||||
return notFound();
|
return notFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
return <div>Show a snippet: {snippet.title}</div>;
|
return (
|
||||||
|
<div>
|
||||||
|
<div className="flex m-4 justify-between items-center">
|
||||||
|
<h1 className="text-xl font-bold">{snippet.title}</h1>
|
||||||
|
<div className="flex gap-4">
|
||||||
|
<button className="p-2 border rounded">Edit</button>
|
||||||
|
<button className="p-2 border rounded">Delete</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<pre className="p-3 border rounded bg-gray-200 border-gray-200">
|
||||||
|
<code>{snippet.code}</code>
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user