From 09603a97a453a74d46ead317484cc1dcad1ec807 Mon Sep 17 00:00:00 2001 From: martinwq997 <2246839805@qq.com> Date: Mon, 1 Sep 2025 18:12:02 +0800 Subject: [PATCH] Restored the document file and modified the scrolling implementation of the Rust pages. --- .../crate-info/[crateName]/index.tsx | 2 +- .../crate-info/[crateName]/layout.tsx | 18 +- .../pages/[org]/rust/rust-ecosystem/index.tsx | 24 +- .../rust/rust-ecosystem/search/index.tsx | 241 +++++++++--------- .../web/pages/[org]/rust/rust-news/index.tsx | 127 ++++----- moon/apps/web/pages/_document.tsx | 7 +- 6 files changed, 220 insertions(+), 199 deletions(-) diff --git a/moon/apps/web/pages/[org]/rust/rust-ecosystem/crate-info/[crateName]/index.tsx b/moon/apps/web/pages/[org]/rust/rust-ecosystem/crate-info/[crateName]/index.tsx index 773fb8104..0f8c606a1 100644 --- a/moon/apps/web/pages/[org]/rust/rust-ecosystem/crate-info/[crateName]/index.tsx +++ b/moon/apps/web/pages/[org]/rust/rust-ecosystem/crate-info/[crateName]/index.tsx @@ -146,7 +146,7 @@ const CratePage = () => { Crate Info - {crateName || 'Crate'} -
+
{/* 左侧内容区域 - 占据2列 */} diff --git a/moon/apps/web/pages/[org]/rust/rust-ecosystem/crate-info/[crateName]/layout.tsx b/moon/apps/web/pages/[org]/rust/rust-ecosystem/crate-info/[crateName]/layout.tsx index 89e6a5107..3e99e328b 100644 --- a/moon/apps/web/pages/[org]/rust/rust-ecosystem/crate-info/[crateName]/layout.tsx +++ b/moon/apps/web/pages/[org]/rust/rust-ecosystem/crate-info/[crateName]/layout.tsx @@ -76,11 +76,11 @@ const CrateInfoLayoutComponent = ({ children }: CrateInfoLayoutProps) => { ], [nsfront, crateName, version]); return ( -
- {/* 搜索栏 */} -
+
+ {/* 搜索栏 - 固定在顶部 */} +
{ />
- {/* 分类标签和版本选择区域 */} -
+ {/* 分类标签和版本选择区域 - 固定在搜索栏下方 */} +
{/* Crate信息 */}
@@ -231,8 +231,10 @@ const CrateInfoLayoutComponent = ({ children }: CrateInfoLayoutProps) => {
- {/* 主要内容区域 */} - {children} + {/* 可滚动内容区域 */} +
+ {children} +
); }; diff --git a/moon/apps/web/pages/[org]/rust/rust-ecosystem/index.tsx b/moon/apps/web/pages/[org]/rust/rust-ecosystem/index.tsx index 9a1fb30e9..ac4a69f91 100644 --- a/moon/apps/web/pages/[org]/rust/rust-ecosystem/index.tsx +++ b/moon/apps/web/pages/[org]/rust/rust-ecosystem/index.tsx @@ -64,7 +64,7 @@ export default function RustEcosystemPage() { id: 107, title: 'CVE-2023-12345:示例漏洞描述', tag: { text: '由国际安全组织报告', color: 'blue' }, - detail: '该漏洞由国际安全组织披露,建议关注官方通告。', + detail: '该漏洞由国际安全组织披露,建议关注官方通告。', }, ] @@ -73,20 +73,28 @@ export default function RustEcosystemPage() { Crate Ecosystem -
+
{/* 顶部搜索区,带背景图 */}
-
+ {/* 背景图层 */} +
+ {/* 内容层 */} +
diff --git a/moon/apps/web/pages/[org]/rust/rust-ecosystem/search/index.tsx b/moon/apps/web/pages/[org]/rust/rust-ecosystem/search/index.tsx index 6387dcf41..d84164f12 100644 --- a/moon/apps/web/pages/[org]/rust/rust-ecosystem/search/index.tsx +++ b/moon/apps/web/pages/[org]/rust/rust-ecosystem/search/index.tsx @@ -160,11 +160,11 @@ export default function SearchResultsPage() { Search Results - Rust Ecosystem -
- {/* 搜索栏 */} -
+
+ {/* 搜索栏 - 固定在顶部 */} +
-
-
+
+
setSearch(e.target.value)} /> @@ -206,10 +207,9 @@ export default function SearchResultsPage() { />
- {/* 分类标签和搜索结果区域 */} -
+ {/* 分类标签 - 固定在搜索栏下方 */} +
- {/* 分类标签 */}
{tabs.map((tab) => (
+
+
- {/* 搜索结果列表容器 */} -
- {/* 标题和结果数量 */} -
-

- ALL -

- - Total 56 results - -
+ {/* 可滚动内容区域 */} +
+
+
+ {/* 搜索结果列表容器 */} +
+ {/* 标题和结果数量 */} +
+

+ ALL +

+ + Total 56 results + +
-
- {searchResults.map((item, index) => ( -
{ - e.currentTarget.style.background = '#EBEBEB' - }} - onMouseLeave={(e) => { - e.currentTarget.style.background = '#ffffff00' - }} - > -
- - {item.type} - -

router.push({ - pathname: `/${router.query.org}/rust/rust-ecosystem/crate-info/${item.name}`, - query: { - crateName: item.name, - version: item.version || '1.0.0' - } - })} - > - {item.name} -

-

- {item.details} -

+
+ {searchResults.map((item, index) => ( +
{ + e.currentTarget.style.background = '#EBEBEB' + }} + onMouseLeave={(e) => { + e.currentTarget.style.background = '#ffffff00' + }} + > +
+ + {item.type} + +

router.push({ + pathname: `/${router.query.org}/rust/rust-ecosystem/crate-info/${item.name}`, + query: { + crateName: item.name, + version: item.version || '1.0.0' + } + })} + > + {item.name} +

+

+ {item.details} +

+
-
- ))} -
+ ))} +
- {/* 分页 */} -
- - 1 - + {/* 分页 */} +
+ + 1 + +
diff --git a/moon/apps/web/pages/[org]/rust/rust-news/index.tsx b/moon/apps/web/pages/[org]/rust/rust-news/index.tsx index d0044b045..68be9fca3 100644 --- a/moon/apps/web/pages/[org]/rust/rust-news/index.tsx +++ b/moon/apps/web/pages/[org]/rust/rust-news/index.tsx @@ -178,15 +178,12 @@ export default function RustNewsPage() { Rust News -
- {/* 搜索栏 */} +
+ {/* 搜索栏 - 固定在顶部 */}
- {/* 主标题 */} -
-

Rust News

-
-
- {/* 新闻列表 */} -
- {newsList - .filter(item => item.title.includes(search) || item.summary.includes(search)) - .map((item) => ( + + {/* 可滚动内容区域 */} +
+ {/* 主标题 */} +
+

Rust News

- {/* 日期 */} -
- {item.date} - {item.year} -
- {/* 竖线分割 */} -
- {/* 内容 */} -
-
- {item.title} - {item.hot && 🔥} + style={{ + width: 360, + height: 14, + flexShrink: 0, + borderRadius: 2, + background: '#3E63DD', + marginTop: 8, + marginBottom: 32, + }} + /> +
+ {/* 新闻列表 */} +
+ {newsList + .filter(item => item.title.includes(search) || item.summary.includes(search)) + .map((item) => ( +
+ {/* 日期 */} +
+ {item.date} + {item.year}
-
- {item.tags.map(tag => ( - - {tag} - - ))} + {/* 竖线分割 */} +
+ {/* 内容 */} +
+
+ {item.title} + {item.hot && 🔥} +
+
+ {item.tags.map(tag => ( + + {tag} + + ))} +
+
{item.summary}
+
+ {/* 详情按钮 */} +
+
-
{item.summary}
-
- {/* 详情按钮 */} -
-
-
- ))} + ))} +
+ {/* 右下角up-icon */}