Skip to content

Commit 458706c

Browse files
committed
feat(example): minor cleanups, add scrollable content example
1 parent 72161f4 commit 458706c

File tree

3 files changed

+22
-10
lines changed

3 files changed

+22
-10
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ test-phantom: $(BIN)
3838
@NODE_ENV=test $(BIN)/karma start karma-phantomjs.conf.js
3939

4040
dev: $(BIN) clean
41-
DRAGGABLE_DEBUG=true $(BIN)/webpack-dev-server
41+
$(BIN)/webpack-dev-server
4242

4343
node_modules/.bin: install
4444

example/example.js

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,17 @@ class App extends React.Component {
8989
<div>You must click my handle to drag me</div>
9090
</div>
9191
</Draggable>
92+
<Draggable handle="strong">
93+
<div className="box no-cursor" style={{display: 'flex', flexDirection: 'column'}}>
94+
<strong className="cursor"><div>Drag here</div></strong>
95+
<div style={{overflow: 'scroll'}}>
96+
<div style={{background: 'yellow', whiteSpace: 'pre-wrap'}}>
97+
I have long scrollable content with a handle
98+
{'\n' + Array(40).fill('x').join('\n')}
99+
</div>
100+
</div>
101+
</div>
102+
</Draggable>
92103
<Draggable cancel="strong" {...dragHandlers}>
93104
<div className="box">
94105
<strong className="no-cursor">Can't drag here</strong>
@@ -144,24 +155,24 @@ class App extends React.Component {
144155
<div className="box">
145156
My position can be changed programmatically. <br />
146157
I have a drag handler to sync state.
147-
<p>
158+
<div>
148159
<a href="#" onClick={this.adjustXPos}>Adjust x ({controlledPosition.x})</a>
149-
</p>
150-
<p>
160+
</div>
161+
<div>
151162
<a href="#" onClick={this.adjustYPos}>Adjust y ({controlledPosition.y})</a>
152-
</p>
163+
</div>
153164
</div>
154165
</Draggable>
155166
<Draggable position={controlledPosition} {...dragHandlers} onStop={this.onControlledDragStop}>
156167
<div className="box">
157168
My position can be changed programmatically. <br />
158169
I have a dragStop handler to sync state.
159-
<p>
170+
<div>
160171
<a href="#" onClick={this.adjustXPos}>Adjust x ({controlledPosition.x})</a>
161-
</p>
162-
<p>
172+
</div>
173+
<div>
163174
<a href="#" onClick={this.adjustYPos}>Adjust y ({controlledPosition.y})</a>
164-
</p>
175+
</div>
165176
</div>
166177
</Draggable>
167178

webpack.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ module.exports = (env, argv) => ({
2424
hot: true,
2525
open: true,
2626
openPage: 'example/index.html',
27+
disableHostCheck: true,
2728
writeToDisk: true,
2829
},
2930
devtool: 'source-map',
@@ -57,7 +58,7 @@ module.exports = (env, argv) => ({
5758
plugins: [
5859
new webpack.EnvironmentPlugin({
5960
// Default values
60-
DRAGGABLE_DEBUG: argv.mode === 'development',
61+
DRAGGABLE_DEBUG: (process.env.DRAGGABLE_DEBUG || ''),
6162
NODE_ENV: ['development', 'production'].includes(argv.mode) ?
6263
argv.mode :
6364
(process.env.NODE_ENV || 'production'),

0 commit comments

Comments
 (0)