-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(pop-confirm): add placement api (#2640)
- Loading branch information
Showing
7 changed files
with
151 additions
and
4 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,5 @@ | ||
--- | ||
"@hi-ui/pop-confirm": minor | ||
--- | ||
|
||
feat: add placement api (透传 Popper 参数) |
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 | ||
--- | ||
|
||
PopConfirm feat: add placement api (透传 Popper 参数) |
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,136 @@ | ||
import Button from '@hi-ui/button' | ||
import React from 'react' | ||
import PopConfirm from '../src' | ||
import { PopperJS } from '@hi-ui/popper' | ||
|
||
/** | ||
* @title 不同方位 | ||
*/ | ||
export const Placement = () => { | ||
const [placement, setPlacement] = React.useState<undefined | PopperJS.Placement>() | ||
|
||
const handleClick = (newPlacement) => () => { | ||
setPlacement(newPlacement) | ||
} | ||
|
||
const title = <span>文字提示</span> | ||
|
||
return ( | ||
<> | ||
<h1>Placement</h1> | ||
<div className="pop-confirm-placement__wrap"> | ||
<table className="placement-table" cellSpacing="5"> | ||
<tbody> | ||
<tr> | ||
<td></td> | ||
<td> | ||
<PopConfirm placement={placement} title={title}> | ||
<Button style={{ width: 100 }} onClick={handleClick('top-start')}> | ||
topStart | ||
</Button> | ||
</PopConfirm> | ||
</td> | ||
<td> | ||
<PopConfirm placement={placement} title={title}> | ||
<Button style={{ width: 100 }} onClick={handleClick('top')}> | ||
top | ||
</Button> | ||
</PopConfirm> | ||
</td> | ||
<td> | ||
<PopConfirm placement={placement} title={title}> | ||
<Button style={{ width: 100 }} onClick={handleClick('top-end')}> | ||
topEnd | ||
</Button> | ||
</PopConfirm> | ||
</td> | ||
<td></td> | ||
</tr> | ||
<tr> | ||
<td> | ||
<PopConfirm placement={placement} title={title}> | ||
<Button style={{ width: 100 }} onClick={handleClick('left-start')}> | ||
leftStart | ||
</Button> | ||
</PopConfirm> | ||
</td> | ||
<td></td> | ||
<td></td> | ||
<td></td> | ||
<td> | ||
<PopConfirm placement={placement} title={title}> | ||
<Button style={{ width: 100 }} onClick={handleClick('right-start')}> | ||
rightStart | ||
</Button> | ||
</PopConfirm> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
<PopConfirm placement={placement} title={title}> | ||
<Button style={{ width: 100 }} onClick={handleClick('left')}> | ||
left | ||
</Button> | ||
</PopConfirm> | ||
</td> | ||
<td></td> | ||
<td></td> | ||
<td></td> | ||
<td> | ||
<PopConfirm placement={placement} title={title}> | ||
<Button style={{ width: 100 }} onClick={handleClick('right')}> | ||
right | ||
</Button> | ||
</PopConfirm> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
<PopConfirm placement={placement} title={title}> | ||
<Button style={{ width: 100 }} onClick={handleClick('left-end')}> | ||
leftEnd | ||
</Button> | ||
</PopConfirm> | ||
</td> | ||
<td></td> | ||
<td></td> | ||
<td></td> | ||
<td> | ||
<PopConfirm placement={placement} title={title}> | ||
<Button style={{ width: 100 }} onClick={handleClick('right-end')}> | ||
rightEnd | ||
</Button> | ||
</PopConfirm> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td></td> | ||
<td> | ||
<PopConfirm placement={placement} title={title}> | ||
<Button style={{ width: 100 }} onClick={handleClick('bottom-start')}> | ||
bottomStart | ||
</Button> | ||
</PopConfirm> | ||
</td> | ||
<td> | ||
<PopConfirm placement={placement} title={title}> | ||
<Button style={{ width: 100 }} onClick={handleClick('bottom')}> | ||
bottom | ||
</Button> | ||
</PopConfirm> | ||
</td> | ||
<td> | ||
<PopConfirm placement={placement} title={title}> | ||
<Button style={{ width: 100 }} onClick={handleClick('bottom-end')}> | ||
bottomEnd | ||
</Button> | ||
</PopConfirm> | ||
</td> | ||
<td></td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
</> | ||
) | ||
} |