-
-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: 添加modalRender的属性 test: 添加的测试用例 fix * fix: 删除多余的空格 * feat: 添加拖拽modal的例子。
- Loading branch information
Showing
5 changed files
with
97 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import 'bootstrap/dist/css/bootstrap.css'; | ||
import '../assets/bootstrap.less'; | ||
import * as React from 'react'; | ||
import Draggable from 'react-draggable'; | ||
import Dialog from '../src/DialogWrap'; | ||
|
||
const MyControl = () => { | ||
const [visible, setVisible] = React.useState(false); | ||
const [disabled, setDisabled] = React.useState(true); | ||
const onClick = () => { | ||
setVisible(true); | ||
} | ||
|
||
const onClose = () => { | ||
setVisible(false); | ||
} | ||
|
||
return ( | ||
<div style={{ margin: 20 }}> | ||
<p> | ||
<button type="button" className="btn btn-primary" onClick={onClick}>show dialog</button> | ||
</p> | ||
<Dialog | ||
visible={visible} | ||
animation="slide-fade" | ||
maskAnimation="fade" | ||
onClose={onClose} | ||
style={{ width: 600 }} | ||
title={( | ||
<div | ||
style={{ | ||
width: '100%', | ||
cursor: 'pointer', | ||
}} | ||
onMouseOver={() => { | ||
if (disabled){ | ||
setDisabled(false) | ||
} | ||
}} | ||
onMouseOut={() => { | ||
setDisabled(true) | ||
}} | ||
// fix eslintjsx-a11y/mouse-events-have-key-events | ||
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/mouse-events-have-key-events.md | ||
onFocus={ () => {} } | ||
onBlur={ () => {}} | ||
// end | ||
>modal</div> | ||
)} | ||
modalRender={modal => <Draggable disabled={disabled}>{modal}</Draggable>} | ||
> | ||
<div | ||
style={{ | ||
height: 200, | ||
}} | ||
> | ||
Day before yesterday I saw a rabbit, and yesterday a deer, and today, you. | ||
</div> | ||
</Dialog> | ||
</div> | ||
); | ||
}; | ||
|
||
export default MyControl; |
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
3b39854
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: