-
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.
- Loading branch information
1 parent
7784e80
commit fd7e519
Showing
7 changed files
with
206 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* title: 事件回调 | ||
*/ | ||
|
||
import React from 'react'; | ||
import { Button, PopConfirm, useMessage } from '@tool-pack/react-ui'; | ||
|
||
const App: React.FC = () => { | ||
const message = useMessage(); | ||
return ( | ||
<PopConfirm | ||
content="确认要删除?" | ||
onCancel={() => message.info('点击取消')} | ||
onConfirm={() => { | ||
message.info('确认删除,稍等...'); | ||
const p = new Promise<void>((resolve) => { | ||
setTimeout(resolve, 1500); | ||
}); | ||
p.then(() => message.success('删除成功!')); | ||
return p; | ||
}}> | ||
<Button>删除</Button> | ||
</PopConfirm> | ||
); | ||
}; | ||
|
||
export default App; |
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,29 @@ | ||
/** | ||
* title: icon | ||
* description: 自定义 icon 或去除 icon。 | ||
*/ | ||
|
||
import React from 'react'; | ||
import { Button, Icon, Icons, PopConfirm, Space } from '@tool-pack/react-ui'; | ||
|
||
const App: React.FC = () => { | ||
return ( | ||
<Space> | ||
<PopConfirm | ||
icon={ | ||
<Icon color="red"> | ||
<Icons.CircleWarningFill /> | ||
</Icon> | ||
} | ||
content="确认要删除?"> | ||
<Button>自定义图标</Button> | ||
</PopConfirm> | ||
|
||
<PopConfirm icon={null} content="确认要删除?"> | ||
<Button>无图标</Button> | ||
</PopConfirm> | ||
</Space> | ||
); | ||
}; | ||
|
||
export default App; |
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,30 @@ | ||
/** | ||
* title: 按钮 | ||
* description: 自定义按钮文本或去除按钮。 | ||
*/ | ||
|
||
import React from 'react'; | ||
import { Button, PopConfirm, Space } from '@tool-pack/react-ui'; | ||
|
||
const App: React.FC = () => { | ||
return ( | ||
<Space> | ||
<PopConfirm | ||
confirmText="confirm" | ||
cancelText="cancel" | ||
content="确认要删除?"> | ||
<Button>自定义文案</Button> | ||
</PopConfirm> | ||
|
||
<PopConfirm cancelText={null} content="确认要删除?"> | ||
<Button>只有确认</Button> | ||
</PopConfirm> | ||
|
||
<PopConfirm confirmText={null} content="确认要删除?"> | ||
<Button>只有取消</Button> | ||
</PopConfirm> | ||
</Space> | ||
); | ||
}; | ||
|
||
export default App; |
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 |
---|---|---|
@@ -1,5 +1,17 @@ | ||
@import '../scss.variable'; | ||
|
||
$r: '#{$prefix}pop-confirm'; | ||
$space: '#{$prefix}space'; | ||
|
||
.#{$r} {} | ||
.#{$r} { | ||
width: 180px; | ||
&__icon { | ||
color: var(--t-color-warning); | ||
} | ||
&__footer { | ||
margin-top: 12px; | ||
.#{$space} { | ||
justify-content: flex-end; | ||
} | ||
} | ||
} |
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