Skip to content

Commit 1950f94

Browse files
committed
Move clickable labels example up to be more prominent and make markup a bit more semantic
1 parent 596eaff commit 1950f94

File tree

3 files changed

+33
-28
lines changed

3 files changed

+33
-28
lines changed

examples/src/index.html

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,6 @@ <h2>Pessimistic Toggle Example</h2>
5353
</p>
5454
<div id="pessimistic-toggle-example"></div>
5555

56-
<h2>Hide Checkboxes Example</h2>
57-
<p>
58-
Checkboxes can be hidden on a node-level by setting <code>showCheckbox: false</code> for any given node. They
59-
can also be more broadly hidden by the passing the <code>onlyLeafCheckboxes</code> property, which will force
60-
checkboxes to render only on leaf nodes.
61-
</p>
62-
<div id="hidden-checkboxes-example"></div>
63-
64-
<h2>Large Data Example</h2>
65-
<p>The checkbox tree is capable of supporting a large number of nodes at once.</p>
66-
<div id="large-data-example"></div>
67-
6856
<h2>Clickable Labels Example</h2>
6957
<p>
7058
By default, clicking on the node label toggles the checkbox value. By providing an <code>onClick</code> property
@@ -77,6 +65,18 @@ <h2>Clickable Labels Example</h2>
7765
</p>
7866
<div id="clickable-labels-example"></div>
7967

68+
<h2>Hide Checkboxes Example</h2>
69+
<p>
70+
Checkboxes can be hidden on a node-level by setting <code>showCheckbox: false</code> for any given node. They
71+
can also be more broadly hidden by the passing the <code>onlyLeafCheckboxes</code> property, which will force
72+
checkboxes to render only on leaf nodes.
73+
</p>
74+
<div id="hidden-checkboxes-example"></div>
75+
76+
<h2>Large Data Example</h2>
77+
<p>The checkbox tree is capable of supporting a large number of nodes at once.</p>
78+
<div id="large-data-example"></div>
79+
8080
<footer class="site-footer">
8181
<span class="site-footer-owner">
8282
<a href="https://github.com/jakezatecky/react-checkbox-tree">React Checkbox Tree</a> is maintained by <a href="https://github.com/jakezatecky">jakezatecky</a>.

examples/src/js/ClickableLabelsExample.js

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -117,24 +117,21 @@ class ClickExample extends React.Component {
117117

118118
render() {
119119
const { checked, expanded, clicked } = this.state;
120-
121-
const notClickedText = 'Not Clicked';
120+
const notClickedText = '(none)';
122121

123122
return (
124-
<div className="row">
125-
<div style={{ width: '50%', display: 'inline-block', verticalAlign: 'top' }}>
126-
<CheckboxTree
127-
checked={checked}
128-
expanded={expanded}
129-
nodes={nodes}
130-
expandOnClick
131-
onCheck={this.onCheck}
132-
onClick={this.onClick}
133-
onExpand={this.onExpand}
134-
/>
135-
</div>
136-
<div style={{ width: '50%', display: 'inline-block', verticalAlign: 'top' }}>
137-
<b>Clicked Node</b>: {clicked.value || notClickedText} <br />
123+
<div className="clickable-labels">
124+
<CheckboxTree
125+
checked={checked}
126+
expanded={expanded}
127+
nodes={nodes}
128+
expandOnClick
129+
onCheck={this.onCheck}
130+
onClick={this.onClick}
131+
onExpand={this.onExpand}
132+
/>
133+
<div className="clickable-labels-info">
134+
<strong>Clicked Node</strong>: {clicked.value || notClickedText}
138135
</div>
139136
</div>
140137
);

examples/src/scss/style.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,11 @@ $rct-border-color: #ccc;
1111
color: $rct-color;
1212
font-family: 'Roboto', sans-serif;
1313
}
14+
15+
.clickable-labels {
16+
display: flex;
17+
18+
> * {
19+
width: 50%;
20+
}
21+
}

0 commit comments

Comments
 (0)