Skip to content
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

feat(popconfirm): make title bold and add description prop #39250

Merged
merged 8 commits into from Dec 8, 2022
13 changes: 12 additions & 1 deletion components/popconfirm/PurePanel.tsx
Expand Up @@ -29,6 +29,7 @@ export interface OverlayProps
| 'okType'
| 'showCancel'
| 'title'
| 'description'
> {
prefixCls: string;
close?: Function;
Expand All @@ -42,6 +43,7 @@ export const Overlay: React.FC<OverlayProps> = (props) => {
okButtonProps,
cancelButtonProps,
title,
description,
cancelText,
okText,
okType = 'primary',
Expand All @@ -60,8 +62,17 @@ export const Overlay: React.FC<OverlayProps> = (props) => {
<div className={`${prefixCls}-inner-content`}>
<div className={`${prefixCls}-message`}>
{icon && <span className={`${prefixCls}-message-icon`}>{icon}</span>}
<div className={`${prefixCls}-message-title`}>{getRenderPropValue(title)}</div>
<div
className={classNames(`${prefixCls}-message-title`, {
[`${prefixCls}-message-title-only`]: !!description,
})}
>
{getRenderPropValue(title)}
</div>
</div>
{description && (
<div className={`${prefixCls}-description`}>{getRenderPropValue(description)}</div>
)}
<div className={`${prefixCls}-buttons`}>
{showCancel && (
<Button onClick={onCancel} size="small" {...cancelButtonProps}>
Expand Down
148 changes: 124 additions & 24 deletions components/popconfirm/__tests__/__snapshots__/demo-extend.test.ts.snap
Expand Up @@ -59,11 +59,16 @@ Array [
</span>
</span>
<div
class="ant-popconfirm-message-title"
class="ant-popconfirm-message-title ant-popconfirm-message-title-only"
>
Title
</div>
</div>
<div
class="ant-popconfirm-description"
>
Open Popconfirm with async logic
</div>
<div
class="ant-popconfirm-buttons"
>
Expand Down Expand Up @@ -148,11 +153,16 @@ Array [
</span>
</span>
<div
class="ant-popconfirm-message-title"
class="ant-popconfirm-message-title ant-popconfirm-message-title-only"
>
Are you sure to delete this task?
Delete the task
</div>
</div>
<div
class="ant-popconfirm-description"
>
Are you sure to delete this task?
</div>
<div
class="ant-popconfirm-buttons"
>
Expand Down Expand Up @@ -237,11 +247,16 @@ exports[`renders ./components/popconfirm/demo/dynamic-trigger.tsx extend context
</span>
</span>
<div
class="ant-popconfirm-message-title"
class="ant-popconfirm-message-title ant-popconfirm-message-title-only"
>
Are you sure delete this task?
Delete the task
</div>
</div>
<div
class="ant-popconfirm-description"
>
Are you sure to delete this task?
</div>
<div
class="ant-popconfirm-buttons"
>
Expand Down Expand Up @@ -353,11 +368,16 @@ Array [
</span>
</span>
<div
class="ant-popconfirm-message-title"
class="ant-popconfirm-message-title ant-popconfirm-message-title-only"
>
Are you sure?
Delete the task
</div>
</div>
<div
class="ant-popconfirm-description"
>
Are you sure to delete this task?
</div>
<div
class="ant-popconfirm-buttons"
>
Expand Down Expand Up @@ -442,11 +462,16 @@ Array [
</span>
</span>
<div
class="ant-popconfirm-message-title"
class="ant-popconfirm-message-title ant-popconfirm-message-title-only"
>
Are you sure?
Delete the task
</div>
</div>
<div
class="ant-popconfirm-description"
>
Are you sure to delete this task?
</div>
<div
class="ant-popconfirm-buttons"
>
Expand Down Expand Up @@ -539,11 +564,16 @@ exports[`renders ./components/popconfirm/demo/placement.tsx extend context corre
</span>
</span>
<div
class="ant-popconfirm-message-title"
class="ant-popconfirm-message-title ant-popconfirm-message-title-only"
>
Are you sure to delete this task?
</div>
</div>
<div
class="ant-popconfirm-description"
>
Delete the task
</div>
<div
class="ant-popconfirm-buttons"
>
Expand Down Expand Up @@ -626,11 +656,16 @@ exports[`renders ./components/popconfirm/demo/placement.tsx extend context corre
</span>
</span>
<div
class="ant-popconfirm-message-title"
class="ant-popconfirm-message-title ant-popconfirm-message-title-only"
>
Are you sure to delete this task?
</div>
</div>
<div
class="ant-popconfirm-description"
>
Delete the task
</div>
<div
class="ant-popconfirm-buttons"
>
Expand Down Expand Up @@ -713,11 +748,16 @@ exports[`renders ./components/popconfirm/demo/placement.tsx extend context corre
</span>
</span>
<div
class="ant-popconfirm-message-title"
class="ant-popconfirm-message-title ant-popconfirm-message-title-only"
>
Are you sure to delete this task?
</div>
</div>
<div
class="ant-popconfirm-description"
>
Delete the task
</div>
<div
class="ant-popconfirm-buttons"
>
Expand Down Expand Up @@ -804,11 +844,16 @@ exports[`renders ./components/popconfirm/demo/placement.tsx extend context corre
</span>
</span>
<div
class="ant-popconfirm-message-title"
class="ant-popconfirm-message-title ant-popconfirm-message-title-only"
>
Are you sure to delete this task?
</div>
</div>
<div
class="ant-popconfirm-description"
>
Delete the task
</div>
<div
class="ant-popconfirm-buttons"
>
Expand Down Expand Up @@ -891,11 +936,16 @@ exports[`renders ./components/popconfirm/demo/placement.tsx extend context corre
</span>
</span>
<div
class="ant-popconfirm-message-title"
class="ant-popconfirm-message-title ant-popconfirm-message-title-only"
>
Are you sure to delete this task?
</div>
</div>
<div
class="ant-popconfirm-description"
>
Delete the task
</div>
<div
class="ant-popconfirm-buttons"
>
Expand Down Expand Up @@ -978,11 +1028,16 @@ exports[`renders ./components/popconfirm/demo/placement.tsx extend context corre
</span>
</span>
<div
class="ant-popconfirm-message-title"
class="ant-popconfirm-message-title ant-popconfirm-message-title-only"
>
Are you sure to delete this task?
</div>
</div>
<div
class="ant-popconfirm-description"
>
Delete the task
</div>
<div
class="ant-popconfirm-buttons"
>
Expand Down Expand Up @@ -1069,11 +1124,16 @@ exports[`renders ./components/popconfirm/demo/placement.tsx extend context corre
</span>
</span>
<div
class="ant-popconfirm-message-title"
class="ant-popconfirm-message-title ant-popconfirm-message-title-only"
>
Are you sure to delete this task?
</div>
</div>
<div
class="ant-popconfirm-description"
>
Delete the task
</div>
<div
class="ant-popconfirm-buttons"
>
Expand Down Expand Up @@ -1156,11 +1216,16 @@ exports[`renders ./components/popconfirm/demo/placement.tsx extend context corre
</span>
</span>
<div
class="ant-popconfirm-message-title"
class="ant-popconfirm-message-title ant-popconfirm-message-title-only"
>
Are you sure to delete this task?
</div>
</div>
<div
class="ant-popconfirm-description"
>
Delete the task
</div>
<div
class="ant-popconfirm-buttons"
>
Expand Down Expand Up @@ -1243,11 +1308,16 @@ exports[`renders ./components/popconfirm/demo/placement.tsx extend context corre
</span>
</span>
<div
class="ant-popconfirm-message-title"
class="ant-popconfirm-message-title ant-popconfirm-message-title-only"
>
Are you sure to delete this task?
</div>
</div>
<div
class="ant-popconfirm-description"
>
Delete the task
</div>
<div
class="ant-popconfirm-buttons"
>
Expand Down Expand Up @@ -1334,11 +1404,16 @@ exports[`renders ./components/popconfirm/demo/placement.tsx extend context corre
</span>
</span>
<div
class="ant-popconfirm-message-title"
class="ant-popconfirm-message-title ant-popconfirm-message-title-only"
>
Are you sure to delete this task?
</div>
</div>
<div
class="ant-popconfirm-description"
>
Delete the task
</div>
<div
class="ant-popconfirm-buttons"
>
Expand Down Expand Up @@ -1421,11 +1496,16 @@ exports[`renders ./components/popconfirm/demo/placement.tsx extend context corre
</span>
</span>
<div
class="ant-popconfirm-message-title"
class="ant-popconfirm-message-title ant-popconfirm-message-title-only"
>
Are you sure to delete this task?
</div>
</div>
<div
class="ant-popconfirm-description"
>
Delete the task
</div>
<div
class="ant-popconfirm-buttons"
>
Expand Down Expand Up @@ -1508,11 +1588,16 @@ exports[`renders ./components/popconfirm/demo/placement.tsx extend context corre
</span>
</span>
<div
class="ant-popconfirm-message-title"
class="ant-popconfirm-message-title ant-popconfirm-message-title-only"
>
Are you sure to delete this task?
</div>
</div>
<div
class="ant-popconfirm-description"
>
Delete the task
</div>
<div
class="ant-popconfirm-buttons"
>
Expand Down Expand Up @@ -1601,11 +1686,16 @@ Array [
</span>
</span>
<div
class="ant-popconfirm-message-title"
class="ant-popconfirm-message-title ant-popconfirm-message-title-only"
>
Title
</div>
</div>
<div
class="ant-popconfirm-description"
>
Open Popconfirm with Promise
</div>
<div
class="ant-popconfirm-buttons"
>
Expand Down Expand Up @@ -1679,11 +1769,16 @@ Array [
</span>
</span>
<div
class="ant-popconfirm-message-title"
class="ant-popconfirm-message-title ant-popconfirm-message-title-only"
>
Are you OK?
</div>
</div>
<div
class="ant-popconfirm-description"
>
Does this look good?
</div>
<div
class="ant-popconfirm-buttons"
>
Expand Down Expand Up @@ -1753,11 +1848,16 @@ Array [
</span>
</span>
<div
class="ant-popconfirm-message-title"
class="ant-popconfirm-message-title ant-popconfirm-message-title-only"
>
Are you OK?
</div>
</div>
<div
class="ant-popconfirm-description"
>
Does this look good?
</div>
<div
class="ant-popconfirm-buttons"
>
Expand Down