This commit is contained in:
hailin 2025-03-25 11:26:10 +08:00
parent fa4545f8fe
commit 318dba9d27
2 changed files with 31 additions and 34 deletions

View File

@ -96,7 +96,6 @@ const BlogArticleWrapper = async ({ params }: { params: { slug: string, locale:
progress: "75%",
statusText: "运行中"
}}
className="sticky top-0 z-50 bg-white"
/>
<div className='mb-40 md:mb-60 w-11/12 lg:w-2/3 xl:w-3/5 mx-auto'>

View File

@ -115,8 +115,7 @@ export function DetailPageHeader({ data }: { data: any }) {
setLoading(true);
setStatusText(source === "icon" ? "正在处理图标操作..." : "正在处理信息操作...");
try {
// 模拟 API 请求
const res = await fetch("/api/stub", {
await fetch("/api/stub", {
method: "POST",
headers: {
"Content-Type": "application/json"
@ -124,7 +123,6 @@ export function DetailPageHeader({ data }: { data: any }) {
body: JSON.stringify({ source })
});
// 假装等待响应
await new Promise((resolve) => setTimeout(resolve, 1000));
setStatusText(`操作成功:来自${source === "icon" ? "图标" : "信息区域"}`);
@ -136,45 +134,45 @@ export function DetailPageHeader({ data }: { data: any }) {
};
return (
<div className="mb-40 md:mb-60 w-11/12 lg:w-2/3 xl:w-3/5 mx-auto">
{/* 上方内容区域 */}
<div className="flex items-start space-x-6">
{/* 左侧图标区域 - 可点击 */}
<button
className="flex items-center justify-center w-32 h-32 border rounded-md text-xl font-bold hover:bg-gray-100 transition"
onClick={() => handleClick("icon")}
disabled={loading}
>
{data?.icon || "Deploy"}
</button>
<div className="fixed top-0 left-0 w-full z-50 bg-white shadow-md">
<div className="w-11/12 lg:w-2/3 xl:w-3/5 mx-auto py-4">
{/* 上方内容区域 */}
<div className="flex items-start space-x-6">
{/* 左侧图标区域 - 可点击 */}
<button
className="flex items-center justify-center w-24 h-24 md:w-32 md:h-32 border rounded-md text-xl font-bold hover:bg-gray-100 transition"
onClick={() => handleClick("icon")}
disabled={loading}
>
{data?.icon || "Deploy"}
</button>
{/* 右侧信息区域 - 可点击 */}
<div
className="text-sm leading-7 space-y-1 cursor-pointer hover:bg-gray-50 p-2 rounded transition"
onClick={() => handleClick("info")}
>
<p><strong></strong>{data?.name || "未命名组件"}</p>
<p><strong></strong>{data?.category || "未知"}</p>
<p><strong></strong>{data?.updated_at || "未提供"}</p>
<p><strong></strong>{data?.company || "未知公司"}</p>
{/* 右侧信息区域 - 可点击 */}
<div
className="text-sm leading-7 space-y-1 cursor-pointer hover:bg-gray-50 p-2 rounded transition"
onClick={() => handleClick("info")}
>
<p><strong></strong>{data?.name || "未命名组件"}</p>
<p><strong></strong>{data?.category || "未知"}</p>
<p><strong></strong>{data?.updated_at || "未提供"}</p>
<p><strong></strong>{data?.company || "未知公司"}</p>
</div>
</div>
</div>
{/* 底部进度条或状态条 */}
<div className="w-full bg-gray-200 rounded-full h-6 overflow-hidden">
<div
className="bg-blue-500 h-full text-white text-center text-sm flex items-center justify-center transition-all duration-300"
style={{ width: data?.progress || "60%" }}
>
{loading ? "操作中..." : statusText}
{/* 底部进度条或状态条 */}
<div className="w-full mt-4 bg-gray-200 rounded-full h-6 overflow-hidden">
<div
className="bg-blue-500 h-full text-white text-center text-sm flex items-center justify-center transition-all duration-300"
style={{ width: data?.progress || "60%" }}
>
{loading ? "操作中..." : statusText}
</div>
</div>
</div>
</div>
);
}
// export function Header() {
// const router = useRouter();