From 2248edcb1dd8a85261e2110bd2466ee2ffdd7b0c Mon Sep 17 00:00:00 2001 From: thinkasany <480968828@qq.com> Date: Thu, 9 Jan 2025 14:24:30 +0800 Subject: [PATCH] feat: support section and title (#468) --- assets/bootstrap/Dialog.less | 10 +++++----- assets/bootstrap/variables.less | 8 ++++---- assets/index/Dialog.less | 2 +- src/Dialog/Content/Panel.tsx | 12 ++++++++---- src/IDialogPropTypes.tsx | 22 +++++----------------- tests/__snapshots__/index.spec.tsx.snap | 9 +++++---- tests/index.spec.tsx | 12 +++++++----- tests/portal.spec.tsx | 6 +++--- 8 files changed, 38 insertions(+), 43 deletions(-) diff --git a/assets/bootstrap/Dialog.less b/assets/bootstrap/Dialog.less index 8f685b2c..5a30ea03 100644 --- a/assets/bootstrap/Dialog.less +++ b/assets/bootstrap/Dialog.less @@ -34,11 +34,11 @@ margin: 10px; // Actual rc-dialog - &-content { + &-section { position: relative; - background-color: @modal-content-bg; - border: 1px solid @modal-content-fallback-border-color; //old browsers fallback (ie8 etc) - border: 1px solid @modal-content-border-color; + background-color: @modal-section-bg; + border: 1px solid @modal-section-fallback-border-color; //old browsers fallback (ie8 etc) + border: 1px solid @modal-section-border-color; border-radius: @border-radius-large; box-shadow: 0 3px 9px rgba(0, 0, 0, .5); background-clip: padding-box; @@ -124,7 +124,7 @@ width: @modal-md; margin: 30px auto; - &-content { + &-section { box-shadow: 0 5px 15px rgba(0, 0, 0, .5); } } diff --git a/assets/bootstrap/variables.less b/assets/bootstrap/variables.less index 1959c342..b9b88d43 100644 --- a/assets/bootstrap/variables.less +++ b/assets/bootstrap/variables.less @@ -596,11 +596,11 @@ @modal-title-line-height: @line-height-base; //** Background color of modal content area -@modal-content-bg: #fff; +@modal-section-bg: #fff; //** Modal content border color -@modal-content-border-color: rgba(0,0,0,.2); +@modal-section-border-color: rgba(0,0,0,.2); //** Modal content border color **for IE8** -@modal-content-fallback-border-color: #999; +@modal-section-fallback-border-color: #999; //** Modal backdrop background color @modal-backdrop-bg: #000; @@ -866,4 +866,4 @@ //** Point at which .dl-horizontal becomes horizontal @dl-horizontal-breakpoint: @grid-float-breakpoint; //** Horizontal line color. -@hr-border: @gray-lighter; \ No newline at end of file +@hr-border: @gray-lighter; diff --git a/assets/index/Dialog.less b/assets/index/Dialog.less index 3f61f260..013bdd54 100644 --- a/assets/index/Dialog.less +++ b/assets/index/Dialog.less @@ -22,7 +22,7 @@ font-weight: bold; } - &-content { + &-section { position: relative; background-color: #ffffff; border: none; diff --git a/src/Dialog/Content/Panel.tsx b/src/Dialog/Content/Panel.tsx index e1653208..188eb1e1 100644 --- a/src/Dialog/Content/Panel.tsx +++ b/src/Dialog/Content/Panel.tsx @@ -94,7 +94,11 @@ const Panel = React.forwardRef((props, ref) => { className={classNames(`${prefixCls}-header`, modalClassNames?.header)} style={{ ...modalStyles?.header }} > -
+
{title}
@@ -111,7 +115,7 @@ const Panel = React.forwardRef((props, ref) => { }, [closable, closeIcon, prefixCls]); const ariaProps = pickAttrs(closableObj, true); - const closeBtnIsDisabled = typeof(closable) === 'object' && closable.disabled; + const closeBtnIsDisabled = typeof closable === 'object' && closable.disabled; const closerNode = closable ? (