-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6c51412
commit 9a01c8d
Showing
11 changed files
with
170 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/** | ||
* iframe: 400 | ||
*/ | ||
import React from 'react'; | ||
import { PageLoading } from '@oceanbase/ui'; | ||
|
||
export default () => { | ||
return <PageLoading />; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React from 'react'; | ||
import { PageLoading } from '@oceanbase/ui'; | ||
import { Card } from '@oceanbase/design'; | ||
|
||
export default () => { | ||
return ( | ||
<Card | ||
title="Card title" | ||
bodyStyle={{ | ||
height: 400, | ||
}} | ||
> | ||
<PageLoading matchWrapperHeight={true} /> | ||
</Card> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/** | ||
* iframe: 600 | ||
*/ | ||
import React from 'react'; | ||
import { Button, Dropdown } from '@oceanbase/design'; | ||
import { PageContainer } from '@oceanbase/ui'; | ||
import { EllipsisOutlined } from '@oceanbase/icons'; | ||
|
||
export default () => { | ||
const loading = true; | ||
return ( | ||
<PageContainer | ||
ghost={false} | ||
loading={loading} | ||
header={{ | ||
title: '页面标题', | ||
reload: { | ||
spin: loading, | ||
}, | ||
breadcrumb: { | ||
items: [ | ||
{ | ||
href: '', | ||
title: '一级页面', | ||
}, | ||
{ | ||
href: '', | ||
title: '二级页面', | ||
}, | ||
{ | ||
title: '当前页面', | ||
}, | ||
], | ||
}, | ||
extra: [ | ||
<Button key="1">次要按钮</Button>, | ||
<Button key="2" type="primary"> | ||
主要按钮 | ||
</Button>, | ||
<Dropdown | ||
menu={{ | ||
items: [ | ||
{ | ||
label: '下拉菜单', | ||
key: '1', | ||
}, | ||
{ | ||
label: '下拉菜单2', | ||
key: '2', | ||
}, | ||
{ | ||
label: '下拉菜单3', | ||
key: '3', | ||
}, | ||
], | ||
}} | ||
> | ||
<Button key="3" style={{ padding: '0 8px' }}> | ||
<EllipsisOutlined /> | ||
</Button> | ||
</Dropdown>, | ||
], | ||
}} | ||
footer={[<Button>重置</Button>, <Button type="primary">提交</Button>]} | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
title: PageLoading 页面级加载 | ||
nav: | ||
title: 业务组件 | ||
path: /biz-components | ||
--- | ||
|
||
## 代码演示 | ||
|
||
<code src="./demo/basic.tsx" title="基本" description="常用于 `dynamicImport` 的加载动画"></code> | ||
|
||
<code src="./demo/with-page-container.tsx" title="页容器加载" description="已内置到 PageContainer,通过 loading 属性控制即可"></code> | ||
|
||
<code src="./demo/matchWrapperHeight.tsx" title="固定高度的容器内加载"></code> | ||
|
||
## API | ||
|
||
| 参数 | 说明 | 类型 | 默认值 | 版本 | | ||
| :----------------- | :--------------- | :--------------- | :----- | :--- | | ||
| matchWrapperHeight | 是否匹配容器高度 | boolean \| false | - | - | | ||
|
||
- 更多 API 详见 [Spin 文档](/components/spin#api) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import React from 'react'; | ||
import { Spin } from '@oceanbase/design'; | ||
import type { SpinProps } from '@oceanbase/design'; | ||
|
||
export interface PageLoadingProps extends SpinProps { | ||
matchWrapperHeight?: boolean; | ||
} | ||
|
||
const PageLoading: React.FC<PageLoadingProps> = ({ | ||
prefixCls: customizePrefixCls, | ||
style, | ||
matchWrapperHeight = false, | ||
...restProps | ||
}) => { | ||
const spinElement = ( | ||
<Spin | ||
size="large" | ||
gray={false} | ||
style={{ | ||
position: 'absolute', | ||
// horizontal align | ||
// 36px is 1/2 of large Spin width | ||
insetInlineStart: 'calc(50% - 36px)', | ||
// vertical align | ||
// 27px is 1/2 of large Spin height | ||
top: 'calc(50% - 27px)', | ||
...style, | ||
}} | ||
{...restProps} | ||
/> | ||
); | ||
|
||
return matchWrapperHeight ? ( | ||
<div | ||
style={{ | ||
height: '100%', | ||
position: 'relative', | ||
}} | ||
> | ||
{spinElement} | ||
</div> | ||
) : ( | ||
spinElement | ||
); | ||
}; | ||
|
||
export default PageLoading; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters