Skip to content

Commit 4caae59

Browse files
committed
feat: 更新Tailwind CSS配置,优化全局样式和依赖项版本
1 parent 754d17f commit 4caae59

File tree

7 files changed

+457
-1026
lines changed

7 files changed

+457
-1026
lines changed

app/docs/[[...slug]]/page.tsx

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,23 @@ import { getGithubLastEdit } from 'fumadocs-core/server';
1010
import defaultMdxComponents from 'fumadocs-ui/mdx';
1111

1212
export default async function Page(props: {
13-
params: Promise<{ slug?: string[] }>;
13+
params: Promise<{ slug?: string[] }>; // 修改类型为 Promise
1414
}) {
15-
const params = await props.params;
15+
const params = await props.params; // 确保 await params
1616
const page = source.getPage(params.slug);
1717
if (!page) notFound();
1818

19-
const time = await getGithubLastEdit({
20-
owner: 'mx-space',
21-
repo: 'docs',
22-
path: `content/docs/${page.file.path}`,
23-
});
19+
let time: Date | undefined;
20+
try {
21+
const lastEdit = await getGithubLastEdit({
22+
owner: 'mx-space',
23+
repo: 'docs',
24+
path: `content/docs/${page.file.path}`,
25+
});
26+
time = lastEdit ?? undefined;
27+
} catch (error) {
28+
console.error(error);
29+
}
2430

2531
const MDX = page.data.body;
2632

@@ -39,7 +45,7 @@ export default async function Page(props: {
3945
<DocsTitle>{page.data.title}</DocsTitle>
4046
<DocsDescription>{page.data.description}</DocsDescription>
4147
<DocsBody>
42-
<MDX components={{ ...defaultMdxComponents }} />
48+
<MDX components={defaultMdxComponents} />
4349
</DocsBody>
4450
</DocsPage>
4551
);
@@ -50,9 +56,9 @@ export async function generateStaticParams() {
5056
}
5157

5258
export async function generateMetadata(props: {
53-
params: Promise<{ slug?: string[] }>;
59+
params: Promise<{ slug?: string[] }>; // 修改类型为 Promise
5460
}) {
55-
const params = await props.params;
61+
const params = await props.params; // 确保 await params
5662
const page = source.getPage(params.slug);
5763
if (!page) notFound();
5864

app/global.css

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
@tailwind base;
2-
@tailwind components;
3-
@tailwind utilities;
4-
5-
@tailwind base;
6-
@tailwind components;
7-
@tailwind utilities;
1+
@import 'tailwindcss';
2+
@import 'fumadocs-ui/css/vitepress.css';
3+
@import 'fumadocs-ui/css/preset.css';
4+
5+
/* path of `fumadocs-ui` relative to the CSS file */
6+
@source '../node_modules/fumadocs-ui/dist/**/*.js';
87

98
/* 无衬线字体 */
109
.font-sans {

content/docs/usage/search.mdx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,34 +19,25 @@ Algolia 是一个数据库实时搜索服务,能够提供毫秒级的数据库
1919

2020
一些额外说明的地方都在图片上标注了,可参考下面的图片。
2121

22-
![](https://pan.vinua.cn/f/XL2Uv/5a93eadc694a7b7cb2898c63a6ebcf88.png)
2322

24-
![](https://pan.vinua.cn/f/xnosz/0d41807b6594531b77163951f7092150.png)
25-
26-
![](https://pan.vinua.cn/f/Emph7/097d062c7ebe6e322be260e3862e7762.png)
27-
28-
![](https://pan.vinua.cn/f/bNEHK/47fcfe70a3b81e8eca2ad96e2aeae17c.png)
2923

3024
### 创建索引(Index)
3125

3226
在新建应用之后,你会直接跳转到如下图所示的界面,只需要在输入框中输入一个索引名称,点击 `Create Index`,即可创建一个索引。
3327

3428
请记住你所创建的索引名称(Index Name),后面的步骤会用到。
3529

36-
![](https://pan.vinua.cn/f/BEdhW/fbf020ae604f07e7d1ed7894c6dec35e.png)
3730

3831

3932
### 获取相关变量
4033

4134
接下来,在左下角找到齿轮图标,进入设置,在右侧找到 `API Keys`,进入,这里有两个变量需要复制下来备用,分别是 `Application ID``Admin API Key`,请复制下这两个变量的值,后面的步骤会用到。
4235

43-
![](https://pan.vinua.cn/f/Np6hO/ab5bdbb18af590cb3aeacba7b5861ce6.png)
4436

4537
### 后台配置
4638

4739
进入后台,设定->系统->Algolia Search,将“开启 Algolia Search”开关打开,将前面准备的 `IndexName``Application ID(AppID)``Admin API Key(ApiKey)` 填入对应的框中,右上角保存即可。
4840

49-
![](https://pan.vinua.cn/f/DeGsA/3331ccce7fe57e4bfd87217998223f30.png)
5041

5142

5243
至此,Algolia 搜索的配置就完成了。稍等一会,就可以尝试在主页用 `Ctrl + K` 调用 Algolia 进行站内搜索了。

package.json

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,38 +16,39 @@
1616
"@orama/orama": "^3.1.3",
1717
"@orama/tokenizers": "^3.1.3",
1818
"@oramacloud/client": "^2.1.4",
19+
"@tailwindcss/postcss": "^4.0.15",
1920
"autocorrect-node": "^2.13.0",
2021
"class-variance-authority": "^0.7.1",
2122
"clsx": "^2.1.1",
2223
"commitizen": "^4.3.1",
2324
"copy-to-clipboard": "^3.3.3",
2425
"cz-conventional-changelog": "^3.3.0",
2526
"dotenv": "^16.4.7",
26-
"framer-motion": "^11.18.2",
27-
"fumadocs-core": "14.6.4",
28-
"fumadocs-mdx": "11.2.1",
27+
"framer-motion": "^12.5.0",
28+
"fumadocs-core": "15.1.2",
29+
"fumadocs-mdx": "11.5.7",
2930
"fumadocs-typescript": "^3.1.0",
30-
"fumadocs-ui": "14.6.4",
31+
"fumadocs-ui": "15.1.2",
3132
"globby": "^14.1.0",
32-
"lucide-react": "^0.469.0",
33-
"next": "15.1.2",
33+
"lucide-react": "^0.483.0",
34+
"next": "15.2.3",
3435
"only-allow": "^1.2.1",
3536
"react": "^19.0.0",
3637
"react-dom": "^19.0.0",
3738
"react-feather": "^2.0.10",
3839
"react-icons": "^5.5.0",
39-
"shiki": "^1.29.2",
40-
"tailwind-merge": "^2.6.0"
40+
"shiki": "^3.2.1",
41+
"tailwind-merge": "^3.0.2"
4142
},
4243
"devDependencies": {
4344
"@types/mdx": "^2.0.13",
44-
"@types/node": "22.10.2",
45+
"@types/node": "22.13.11",
4546
"@types/react": "^19.0.12",
4647
"@types/react-dom": "^19.0.4",
4748
"autoprefixer": "^10.4.21",
4849
"postcss": "^8.5.3",
4950
"prettier": "^3.5.3",
50-
"tailwindcss": "^3.4.17",
51+
"tailwindcss": "^4.0.15",
5152
"tsx": "^4.19.3",
5253
"typescript": "^5.8.2"
5354
},

0 commit comments

Comments
 (0)