Skip to content

Commit 3cfa7ae

Browse files
committed
Hide web part tile completely when empty
1 parent 60aae21 commit 3cfa7ae

File tree

3 files changed

+21
-11
lines changed

3 files changed

+21
-11
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22

33
## 1.2.3
44

5+
**Enhancements**
6+
57
- Optimized telemetry so that it only pushes control data
8+
- `WebPartTitle` hide control completely when empty
69

710
## 1.2.2
811

docs/documentation/docs/about/release-notes.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22

33
## 1.2.3
44

5+
**Enhancements**
6+
57
- Optimized telemetry so that it only pushes control data
8+
- `WebPartTitle` hide control completely when empty
69

710
## 1.2.2
811

src/controls/webPartTitle/WebPartTitle.tsx

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,20 @@ export class WebPartTitle extends React.Component<IWebPartTitleProps, {}> {
4141
* Default React component render method
4242
*/
4343
public render(): React.ReactElement<IWebPartTitleProps> {
44-
return (
45-
<div className={`${styles.webPartTitle} ${this.props.className ? this.props.className : ''}` }>
46-
{
47-
this.props.displayMode === DisplayMode.Edit && <textarea placeholder={strings.WebPartTitlePlaceholder} aria-label={strings.WebPartTitleLabel} onChange={this._onChange} defaultValue={this.props.title}></textarea>
48-
}
49-
50-
{
51-
this.props.displayMode !== DisplayMode.Edit && this.props.title && <span>{this.props.title}</span>
52-
}
53-
</div>
54-
);
44+
if (this.props.title || this.props.displayMode === DisplayMode.Edit) {
45+
return (
46+
<div className={`${styles.webPartTitle} ${this.props.className ? this.props.className : ''}` }>
47+
{
48+
this.props.displayMode === DisplayMode.Edit && <textarea placeholder={strings.WebPartTitlePlaceholder} aria-label={strings.WebPartTitleLabel} onChange={this._onChange} defaultValue={this.props.title}></textarea>
49+
}
50+
51+
{
52+
this.props.displayMode !== DisplayMode.Edit && this.props.title && <span>{this.props.title}</span>
53+
}
54+
</div>
55+
);
56+
}
57+
58+
return null;
5559
}
5660
}

0 commit comments

Comments
 (0)