Skip to content

Commit 9e80b90

Browse files
committed
Add ScrollBlocker component
1 parent 39570b4 commit 9e80b90

File tree

5 files changed

+63
-24
lines changed

5 files changed

+63
-24
lines changed

.gitignore

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,2 @@
1-
# Logs
2-
logs
3-
*.log
4-
5-
# Runtime data
6-
pids
7-
*.pid
8-
*.seed
9-
10-
# Directory for instrumented libs generated by jscoverage/JSCover
11-
lib-cov
12-
13-
# Coverage directory used by tools like istanbul
14-
coverage
15-
16-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
17-
.grunt
18-
19-
# Compiled binary addons (http://nodejs.org/api/addons.html)
20-
build/Release
21-
22-
# Dependency directory
23-
# Deployed apps should consider commenting this line out:
24-
# see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git
1+
.DS_Store
252
node_modules

index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
var ScrollBlocker = require('src/ScrollBlocker');
2+
3+
module.exports = {
4+
ScrollBlocker: ScrollBlocker
5+
}

package.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"name": "react-scroll-components",
3+
"version": "0.0.1",
4+
"description": "A set of components that react to page scrolling",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"repository": {
10+
"type": "git",
11+
"url": "https://github.com/jeroencoumans/react-scroll-components.git"
12+
},
13+
"keywords": [
14+
"react",
15+
"scroll",
16+
"scrolling",
17+
"react-component"
18+
],
19+
"author": "Jeroen Coumans <jeroencoumans@gmail.com>",
20+
"license": "MIT",
21+
"bugs": {
22+
"url": "https://github.com/jeroencoumans/react-scroll-components/issues"
23+
},
24+
"homepage": "https://github.com/jeroencoumans/react-scroll-components",
25+
"peerDependencies": {
26+
"react": "^0.10.0"
27+
}
28+
}

src/ScrollBlocker.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.ScrollBlocker {
2+
pointer-events: none;
3+
}

src/ScrollBlocker.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/** @jsx React.DOM */
2+
var React = require('react');
3+
var cx = require('react/lib/cx');
4+
5+
var ScrollBlocker = React.createClass({
6+
7+
getDefaultProps: function () {
8+
return {
9+
active: false
10+
};
11+
},
12+
13+
render: function () {
14+
var classes = cx({
15+
'ScrollBlocker': this.props.active
16+
});
17+
18+
return (
19+
<div className={cx(classes, this.props.className)}>
20+
{this.props.children}
21+
</div>
22+
);
23+
}
24+
});
25+
26+
module.exports = ScrollBlocker;

0 commit comments

Comments
 (0)