-
Notifications
You must be signed in to change notification settings - Fork 0
Modal #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Modal #25
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
bc26fe8
init modal
hoshinogami b031eb1
Merge branch 'master' of https://github.com/Pivot-Studio/pivot-design…
hoshinogami 71e8248
feat:添加modalprops
hoshinogami 302a987
feat:modal
hoshinogami 904d307
feat:add dragge
hoshinogami d2a8d53
style:close icon
hoshinogami 863a8ca
fix:dragge fuction
hoshinogami daf5d9f
fix:skeleton li style effect gloal
hoshinogami 250fb89
fix:change close icon
hoshinogami 7003908
fix:change close icon
hoshinogami b5306ef
fix;button disabled prevent default
hoshinogami 966f8f8
feat: add modal dragge
hoshinogami 88e906e
feat: add modal dragge
hoshinogami 78bdc7a
Merge branch 'master' of https://github.com/Pivot-Studio/pivot-design…
hoshinogami 6c54e83
fix:modal dragge position not update
hoshinogami 021145c
feat:add useModal
hoshinogami fd4c268
feat:useModal Modalcancel and modalok
hoshinogami 42756ae
feat:add description
hoshinogami 443b721
chore: (Modal)remove useless
5250089
chore: (Modal)type
2b31fb3
fix:card line-height problem
hoshinogami 14b25a0
fix:card mdx
hoshinogami 9029e64
chore: [Modal]样式、文档优化
9919e6a
feat: [Modal]props优化
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,23 @@ | ||
import { Button, Modal } from 'pivot-design'; | ||
import React, { useState } from 'react'; | ||
const App: React.FC = () => { | ||
const [open, setOpen] = useState(false); | ||
const onchange = () => { | ||
setOpen(true); | ||
}; | ||
const onOk = () => { | ||
setOpen(false); | ||
}; | ||
const onCancel = () => { | ||
setOpen(false); | ||
}; | ||
return ( | ||
<> | ||
<Modal title="这是" open={open} onOk={onOk} onCancel={onCancel}> | ||
h1这是内容 | ||
</Modal> | ||
<Button onClick={onchange}>按钮</Button> | ||
</> | ||
); | ||
}; | ||
export default App; |
This file contains hidden or 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,31 @@ | ||
import { Button, Modal } from 'pivot-design'; | ||
import React, { useState } from 'react'; | ||
const App: React.FC = () => { | ||
const [open, setOpen] = useState(false); | ||
const onchange = () => { | ||
setOpen(true); | ||
}; | ||
const onOk = () => { | ||
setOpen(false); | ||
}; | ||
const onCancel = () => { | ||
setOpen(false); | ||
}; | ||
return ( | ||
<> | ||
<Modal | ||
title="这是" | ||
content="Hello world" | ||
open={open} | ||
onOk={onOk} | ||
onCancel={onCancel} | ||
footerButtonDirection={'col'} | ||
cancelButtonProps={{ disabled: true }} | ||
> | ||
<p>h1这是内容</p> | ||
</Modal> | ||
<Button onClick={onchange}>竖版</Button> | ||
</> | ||
); | ||
}; | ||
export default App; |
This file contains hidden or 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,43 @@ | ||
import { Button, Modal } from 'pivot-design'; | ||
import React, { useState } from 'react'; | ||
const App: React.FC = () => { | ||
const [openOne, setOpenOne] = useState(false); | ||
const [openSecond, setOpenSecond] = useState(false); | ||
const onchangeOne = () => { | ||
setOpenOne(true); | ||
}; | ||
const onOkOne = () => { | ||
setOpenOne(false); | ||
}; | ||
const onCancelOne = () => { | ||
setOpenOne(false); | ||
}; | ||
|
||
const onchangeSecond = () => { | ||
setOpenSecond(true); | ||
}; | ||
|
||
const onCancelSecond = () => { | ||
setOpenSecond(false); | ||
}; | ||
return ( | ||
<> | ||
<Modal title="没有蒙层的模态框" open={openOne} onOk={onOkOne} onCancel={onCancelOne} hasMask={false}> | ||
没有蒙层 | ||
</Modal> | ||
<Button onClick={onchangeOne}>没有蒙层</Button> | ||
|
||
<Modal | ||
title="点击蒙层不会消失的模态框" | ||
open={openSecond} | ||
onCancel={onCancelSecond} | ||
maskClosable={false} | ||
hasMask={true} | ||
> | ||
点击蒙层不会消失的模态框 | ||
</Modal> | ||
<Button onClick={onchangeSecond}>点击蒙层</Button> | ||
</> | ||
); | ||
}; | ||
export default App; |
This file contains hidden or 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,23 @@ | ||
import { Button, Modal } from 'pivot-design'; | ||
import React, { useState } from 'react'; | ||
const App: React.FC = () => { | ||
const [open, setOpen] = useState(false); | ||
const onchange = () => { | ||
setOpen(true); | ||
}; | ||
const onOk = () => { | ||
setOpen(false); | ||
}; | ||
const onCancel = () => { | ||
setOpen(false); | ||
}; | ||
return ( | ||
<> | ||
<Modal title="模态框" open={open} onOk={onOk} onCancel={onCancel} position={{ x: 0, y: 100 }}> | ||
<p>h1这是内容</p> | ||
</Modal> | ||
<Button onClick={onchange}>按钮</Button> | ||
</> | ||
); | ||
}; | ||
export default App; |
This file contains hidden or 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,18 @@ | ||
import { Button, Modal } from 'pivot-design'; | ||
import React from 'react'; | ||
|
||
const App: React.FC = () => { | ||
return ( | ||
<Button | ||
onClick={() => { | ||
Modal.show({ | ||
title: 'Modal', | ||
children: 'show调起的对话框', | ||
}); | ||
}} | ||
> | ||
Show | ||
</Button> | ||
); | ||
}; | ||
export default App; |
This file contains hidden or 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,43 @@ | ||
# Modal | ||
|
||
模态对话框组件,用于展示需要用户确认的重要信息。 | ||
|
||
## 基本用法 | ||
|
||
最基本的模态对话框用法 | ||
|
||
<CodeBlock line={'5-7'}> | ||
<Common /> | ||
</CodeBlock> | ||
|
||
## 底部按钮组定制 | ||
|
||
提供自定义底部按钮,可以通过 `OkButtonProps`,`cancelButtonProps` 控制 Button,还可以传入 `footer` 来自定义模态框的底部。 | ||
|
||
<CodeBlock line={'7-11'}> | ||
<FooterRow /> | ||
</CodeBlock> | ||
|
||
## 弹窗出现位置 | ||
|
||
通过 `position` 属性,从而改变模态框的出现位置。 | ||
|
||
<CodeBlock line={'7-11'}> | ||
<Position /> | ||
</CodeBlock> | ||
|
||
## 蒙层动作自定义 | ||
|
||
你可以通过给 `hasMask` 传入 `false` 来关闭模态框的蒙层。 | ||
|
||
<CodeBlock line={'7-11'}> | ||
<Mask /> | ||
</CodeBlock> | ||
|
||
## 声明式调用 | ||
|
||
你可以使用 `Modal.show(props)` 的方式来调起一个模态框。 | ||
|
||
<CodeBlock line={'7-11'}> | ||
<UseModal /> | ||
</CodeBlock> |
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.