Skip to content

Commit

Permalink
docs(config): 增加扩展首页 FAQ
Browse files Browse the repository at this point in the history
  • Loading branch information
KuangPF committed Aug 3, 2023
1 parent 5a5c831 commit 26fc809
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
30 changes: 30 additions & 0 deletions example/docs/config/FAQ.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,33 @@ order: 3
Here are some dumi-theme-antd common questions and official answers for your reference.

> WIP
## How to fully customize the homepage

The home page of `dumi-theme-antd` is generated according to the configuration by default, and there will inevitably be some custom modules in the actual use process. `dumi-theme-antd` internally separates the home page module into a built-in component of `HomeBaseLayout`, if you want While fully customizing the homepage and wanting to retain the layout of the built-in homepage, it can be introduced and used in the page. For example, to create a new page:

```md
<!-- .dumi/pages/index.md -->

<HomeBaseLayout></HomeBaseLayout>
....some text or images
<YourCustomComponent></YourCustomComponent>
```

Or import it as a React component:

```tsx | pure
/*.dumi/pages/index.tsx */
import HomeBaseLayout from 'dumi-theme-antd/homeBaseLayout';

const CustomHomePage = () => {
return (
<div>
<HomeBaseLayout />
<div>other content</div>
</div>
);
};

export default CustomHomePage;
```
30 changes: 30 additions & 0 deletions example/docs/config/FAQ.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,33 @@ order: 3
以下整理了一些 dumi-theme-antd 常见的问题和官方答复,可供参考。

> WIP
## 如何完全自定义首页

`dumi-theme-antd` 首页默认是根据配置生成,在实际使用过程中难免会存在一些定制模块,`dumi-theme-antd`内部将首页模块单独抽离成了 `HomeBaseLayout` 内置组件,如果想在完全自定义首页的同时又想保留内置首页的布局,可在页面中引入使用。例如,新建页面:

```md
<!-- .dumi/pages/index.md -->

<HomeBaseLayout></HomeBaseLayout>
.... some text or images
<YourCustomComponent></YourCustomComponent>
```

或者以 React 组件的形式引入:

```tsx | pure
/* .dumi/pages/index.tsx */
import HomeBaseLayout from 'dumi-theme-antd/homeBaseLayout';

const CustomHomePage = () => {
return (
<div>
<HomeBaseLayout />
<div>other content</div>
</div>
);
};

export default CustomHomePage;
```

0 comments on commit 26fc809

Please sign in to comment.