Skip to content

Commit 05381cd

Browse files
committed
fix(dialog): hide header if title is empty
1 parent 029a8eb commit 05381cd

File tree

3 files changed

+27
-9
lines changed

3 files changed

+27
-9
lines changed

demo/DialogExamples.jsx

+16
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,22 @@ export function DialogExamples() {
2525
</a>
2626
</Dialog>
2727
</div>
28+
<div className="col-6">
29+
<h1 className="h4">No header Dialog</h1>
30+
<Dialog
31+
body={
32+
<div>
33+
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Quibusdam sequi vero sapiente delectus error
34+
sunt, a eveniet nobis est ex magni nesciunt magnam. Eaque eius hic eligendi dolorum ut quas?
35+
</div>
36+
}
37+
keyboard={false}
38+
>
39+
<a href="" className="btn btn-primary">
40+
No header Dialog
41+
</a>
42+
</Dialog>
43+
</div>
2844
<div className="col-6">
2945
<h1 className="h4 mt-3">Scrolling long content Dialog</h1>
3046
<Dialog

demo/demo.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ ReactDOM.render(
2222
<StatefulTabs
2323
vertical={true}
2424
onlyRenderActiveTab={true}
25-
initialTab={7}
25+
initialTab={0}
2626
tabs={[
2727
{
2828
title: 'Dialog',

src/dialog/Modal.jsx

+10-8
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,16 @@ export function Modal({
7878
onClick={stopPropagation}
7979
>
8080
<div className="modal-content">
81-
<div className="modal-header">
82-
<h5 className="modal-title">{title}</h5>
83-
{useTimesClose && (
84-
<button type="button" className="close" onClick={closeAndHide} aria-label="Close">
85-
<span aria-hidden="true">&times;</span>
86-
</button>
87-
)}
88-
</div>
81+
{title && (
82+
<div className="modal-header">
83+
<h5 className="modal-title">{title}</h5>
84+
{useTimesClose && (
85+
<button type="button" className="close" onClick={closeAndHide} aria-label="Close">
86+
<span aria-hidden="true">&times;</span>
87+
</button>
88+
)}
89+
</div>
90+
)}
8991
<div className="modal-body">{renderObjectOrFunction(body, { close: closeAndHide })}</div>
9092
{footer && <div className="modal-footer">{renderObjectOrFunction(footer, { close: closeAndHide })}</div>}
9193
</div>

0 commit comments

Comments
 (0)