Skip to content

Commit aa68b3f

Browse files
committed
Remove slightly unnecessary <span> tag
1 parent e83c8d1 commit aa68b3f

File tree

1 file changed

+31
-28
lines changed

1 file changed

+31
-28
lines changed

src/js/TreeNode.js

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -197,34 +197,37 @@ class TreeNode extends React.Component {
197197
const clickable = onClick.toString() !== TreeNode.defaultProps.onClick.toString();
198198
const inputId = `${treeId}-${value.split(' ').join('_')}`;
199199

200-
return (
201-
<span>
202-
<label htmlFor={inputId}>
203-
<NativeCheckbox
204-
checked={checked === 1}
205-
disabled={disabled}
206-
id={inputId}
207-
indeterminate={checked === 2}
208-
onChange={this.onCheck}
209-
/>
210-
<span className="rct-checkbox">
211-
{this.renderCheckboxIcon()}
212-
</span>
213-
{!clickable ? children : null}
214-
</label>
215-
{clickable ? (
216-
<span
217-
className="rct-node-clickable"
218-
onClick={this.onClick}
219-
onKeyPress={this.onClick}
220-
role="link"
221-
tabIndex={0}
222-
>
223-
{children}
224-
</span>
225-
) : null}
226-
</span>
227-
);
200+
const render = [(
201+
<label htmlFor={inputId}>
202+
<NativeCheckbox
203+
checked={checked === 1}
204+
disabled={disabled}
205+
id={inputId}
206+
indeterminate={checked === 2}
207+
onChange={this.onCheck}
208+
/>
209+
<span className="rct-checkbox">
210+
{this.renderCheckboxIcon()}
211+
</span>
212+
{!clickable ? children : null}
213+
</label>
214+
)];
215+
216+
if (clickable) {
217+
render.push((
218+
<span
219+
className="rct-node-clickable"
220+
onClick={this.onClick}
221+
onKeyPress={this.onClick}
222+
role="link"
223+
tabIndex={0}
224+
>
225+
{children}
226+
</span>
227+
));
228+
}
229+
230+
return render;
228231
}
229232

230233
renderLabel() {

0 commit comments

Comments
 (0)