Skip to content

Commit 18b6dcb

Browse files
authored
conditionally renders Card__header if title prop given (#471)
1 parent 14bc756 commit 18b6dcb

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

spec/__snapshots__/Storyshots.test.js.snap

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11114,9 +11114,6 @@ exports[`Storyshots Design System/Table Table On Card No Padding 1`] = `
1111411114
<section
1111511115
className="Card Card--lg Card--no-padding"
1111611116
>
11117-
<div
11118-
className="Card__header"
11119-
/>
1112011117
<div
1112111118
id="Some table container"
1112211119
style={

src/Card/Card.jsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@ const Card = ({
2525
}) => {
2626
const cardChildren = (
2727
<Fragment>
28-
<div className="Card__header">
29-
{ title && <h2 className="Card__title">{title}</h2> }
30-
{ helperText && <span className="Card__helper-text">{helperText}</span>}
31-
</div>
28+
{ title && (
29+
<div className="Card__header">
30+
<h2 className="Card__title">{title}</h2>
31+
{ helperText && <span className="Card__helper-text">{helperText}</span>}
32+
</div>
33+
)}
3234

3335
{ divided && <hr className="Card__divider" /> }
3436
{ subTitle && <h3 className="Card__subtitle">{subTitle}</h3> }

0 commit comments

Comments
 (0)