Skip to content

Commit

Permalink
feat(popconfirm): make title bold and add description prop(update demos)
Browse files Browse the repository at this point in the history
  • Loading branch information
xhh0223 committed Dec 5, 2022
1 parent 9147c97 commit 0b77614
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 12 deletions.
1 change: 1 addition & 0 deletions components/popconfirm/demo/async.tsx
Expand Up @@ -26,6 +26,7 @@ const App: React.FC = () => {
return (
<Popconfirm
title="Title"
description="Open Popconfirm with async logic"
open={open}
onConfirm={handleOk}
okButtonProps={{ loading: confirmLoading }}
Expand Down
3 changes: 2 additions & 1 deletion components/popconfirm/demo/dynamic-trigger.tsx
Expand Up @@ -36,7 +36,8 @@ const App: React.FC = () => {
return (
<div>
<Popconfirm
title="Are you sure delete this task?"
title="删除任务"
description="Are you sure delete this task?"
open={open}
onOpenChange={handleOpenChange}
onConfirm={confirm}
Expand Down
6 changes: 5 additions & 1 deletion components/popconfirm/demo/icon.tsx
Expand Up @@ -3,7 +3,11 @@ import { QuestionCircleOutlined } from '@ant-design/icons';
import { Popconfirm } from 'antd';

const App: React.FC = () => (
<Popconfirm title="Are you sure?" icon={<QuestionCircleOutlined style={{ color: 'red' }} />}>
<Popconfirm
title="删除任务"
description="Are you sure?"
icon={<QuestionCircleOutlined style={{ color: 'red' }} />}
>
<a href="#">Delete</a>
</Popconfirm>
);
Expand Down
2 changes: 1 addition & 1 deletion components/popconfirm/demo/locale.tsx
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { Popconfirm } from 'antd';

const App: React.FC = () => (
<Popconfirm title="Are you sure?" okText="Yes" cancelText="No">
<Popconfirm title="删除任务" description="Are you sure?" okText="Yes" cancelText="No">
<a href="#">Delete</a>
</Popconfirm>
);
Expand Down
61 changes: 55 additions & 6 deletions components/popconfirm/demo/placement.tsx
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import { Button, message, Popconfirm } from 'antd';

const text = 'Are you sure to delete this task?';
const description = '删除任务';

const confirm = () => {
message.info('Clicked on Yes.');
Expand All @@ -10,15 +11,30 @@ const confirm = () => {
const App: React.FC = () => (
<div className="demo">
<div style={{ marginLeft: 70, whiteSpace: 'nowrap' }}>
<Popconfirm placement="topLeft" title={text} onConfirm={confirm} okText="Yes" cancelText="No">
<Popconfirm
placement="topLeft"
title={text}
description={description}
onConfirm={confirm}
okText="Yes"
cancelText="No"
>
<Button>TL</Button>
</Popconfirm>
<Popconfirm placement="top" title={text} onConfirm={confirm} okText="Yes" cancelText="No">
<Popconfirm
placement="top"
title={text}
description={description}
onConfirm={confirm}
okText="Yes"
cancelText="No"
>
<Button>Top</Button>
</Popconfirm>
<Popconfirm
placement="topRight"
title={text}
description={description}
onConfirm={confirm}
okText="Yes"
cancelText="No"
Expand All @@ -27,15 +43,30 @@ const App: React.FC = () => (
</Popconfirm>
</div>
<div style={{ width: 70, float: 'left' }}>
<Popconfirm placement="leftTop" title={text} onConfirm={confirm} okText="Yes" cancelText="No">
<Popconfirm
placement="leftTop"
title={text}
description={description}
onConfirm={confirm}
okText="Yes"
cancelText="No"
>
<Button>LT</Button>
</Popconfirm>
<Popconfirm placement="left" title={text} onConfirm={confirm} okText="Yes" cancelText="No">
<Popconfirm
placement="left"
title={text}
description={description}
onConfirm={confirm}
okText="Yes"
cancelText="No"
>
<Button>Left</Button>
</Popconfirm>
<Popconfirm
placement="leftBottom"
title={text}
description={description}
onConfirm={confirm}
okText="Yes"
cancelText="No"
Expand All @@ -47,18 +78,27 @@ const App: React.FC = () => (
<Popconfirm
placement="rightTop"
title={text}
description={description}
onConfirm={confirm}
okText="Yes"
cancelText="No"
>
<Button>RT</Button>
</Popconfirm>
<Popconfirm placement="right" title={text} onConfirm={confirm} okText="Yes" cancelText="No">
<Popconfirm
placement="right"
title={text}
description={description}
onConfirm={confirm}
okText="Yes"
cancelText="No"
>
<Button>Right</Button>
</Popconfirm>
<Popconfirm
placement="rightBottom"
title={text}
description={description}
onConfirm={confirm}
okText="Yes"
cancelText="No"
Expand All @@ -70,18 +110,27 @@ const App: React.FC = () => (
<Popconfirm
placement="bottomLeft"
title={text}
description={description}
onConfirm={confirm}
okText="Yes"
cancelText="No"
>
<Button>BL</Button>
</Popconfirm>
<Popconfirm placement="bottom" title={text} onConfirm={confirm} okText="Yes" cancelText="No">
<Popconfirm
placement="bottom"
title={text}
description={description}
onConfirm={confirm}
okText="Yes"
cancelText="No"
>
<Button>Bottom</Button>
</Popconfirm>
<Popconfirm
placement="bottomRight"
title={text}
description={description}
onConfirm={confirm}
okText="Yes"
cancelText="No"
Expand Down
7 changes: 6 additions & 1 deletion components/popconfirm/demo/promise.tsx
Expand Up @@ -8,7 +8,12 @@ const App: React.FC = () => {
});

return (
<Popconfirm title="Title" onConfirm={confirm} onOpenChange={() => console.log('open change')}>
<Popconfirm
title="Title"
description="Open Popconfirm with Promise"
onConfirm={confirm}
onOpenChange={() => console.log('open change')}
>
<Button type="primary">Open Popconfirm with Promise</Button>
</Popconfirm>
);
Expand Down
9 changes: 7 additions & 2 deletions components/popconfirm/demo/render-panel.tsx
Expand Up @@ -5,8 +5,13 @@ const { _InternalPanelDoNotUseOrYouWillBeFired: InternalPopconfirm } = Popconfir

const App: React.FC = () => (
<>
<InternalPopconfirm title="Are you OK?" />
<InternalPopconfirm title="Are you OK?" placement="bottomRight" style={{ width: 250 }} />
<InternalPopconfirm title="你还好吗" description="Are you OK?" />
<InternalPopconfirm
title="你还好吗"
description="Are you OK?"
placement="bottomRight"
style={{ width: 250 }}
/>
</>
);

Expand Down

0 comments on commit 0b77614

Please sign in to comment.