forked from XiaoMi/hiui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(notification): 支持自定义 notification 配置 (XiaoMi#2832)
* feat(notification): 支持指定portal挂载(XiaoMi#2831) * chore(notification): 生成变更记录文件 * chore: 修改container类型 * feat(notification): 重写自定义portal和zIndex功能(XiaoMi#2831) * feat(notification): 重写自定义属性示例(XiaoMi#2831) * feat(notification): 删除toast修改部分 --------- Co-authored-by: xiamiao <[email protected]>
- Loading branch information
1 parent
ba60d8c
commit 8dc9afe
Showing
5 changed files
with
70 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@hi-ui/notification": minor | ||
--- | ||
|
||
feat: 支持自定义 notification 配置 |
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,5 @@ | ||
--- | ||
"@hi-ui/hiui": patch | ||
--- | ||
|
||
feat(notification): 支持自定义 notification 配置 |
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,54 @@ | ||
import React, { useState, useMemo } from 'react' | ||
import { createNotification } from '../src' | ||
import Button from '@hi-ui/button' | ||
|
||
/** | ||
* @title notification 属性自定义 | ||
*/ | ||
export const Custom = () => { | ||
const [container, setContainer] = useState<HTMLElement | undefined>() | ||
|
||
const notification = useMemo( | ||
() => | ||
createNotification({ | ||
container: container, | ||
zIndex: 2000, | ||
}), | ||
[container] | ||
) | ||
|
||
return ( | ||
<> | ||
<h1>Custom</h1> | ||
<div | ||
ref={(e) => { | ||
setContainer(e) | ||
}} | ||
id="ddd" | ||
style={{ | ||
width: 400, | ||
height: 300, | ||
background: 'rgb(245, 247, 250)', | ||
|
||
// Need add it | ||
position: 'relative', | ||
overflow: 'hidden', | ||
}} | ||
></div> | ||
|
||
<div className="notification-custom__wrap"> | ||
<Button | ||
onClick={() => { | ||
notification.open({ | ||
title: '数据备份通知', | ||
content: | ||
'各位同学请注意,将于2019.08.10 00:00:00 -08:00:00 期间进行系统服务器升级维护,请做好数据备份工作,以防丢失。带来不便,敬请谅解!', | ||
}) | ||
}} | ||
> | ||
Notice | ||
</Button> | ||
</div> | ||
</> | ||
) | ||
} |
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