Skip to content

Commit 15d9a33

Browse files
committed
initial
0 parents  commit 15d9a33

File tree

11 files changed

+165
-0
lines changed

11 files changed

+165
-0
lines changed

.babelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": [["@babel/env"]]
3+
}

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
tab_width = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
.idea
3+
yarn.lock
4+
dist

.npmignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
src
2+
.idea
3+
yarn.lock
4+
yarn-error.log
5+
.DS_Store
6+
.babelrc
7+
rollup.config.js
8+
.editorconfig

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# CHANGELOG
2+
3+
## 1.0.0
4+
5+
- Initial release

LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
The MIT License (MIT)
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in
11+
all copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# use-resize-observer
2+
3+
A React hook to use a Resize Observer.
4+
5+
## Usage
6+
7+
```
8+
import React, { useRef } from "react";
9+
import useResizeObserver from "use-resize-observer";
10+
11+
const App = () => {
12+
const ref = useRef();
13+
const { width, height } = useResizeObserver(ref);
14+
15+
return (
16+
<div ref={ref}>
17+
Size: {width}x{height}
18+
</div>
19+
);
20+
};
21+
```

browserslist

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
last 1 version
2+
> 1%
3+
not dead

package.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"name": "use-resize-observer",
3+
"version": "1.0.0",
4+
"main": "dist/bundle.cjs.js",
5+
"module": "dist/bundle.esm.js",
6+
"repository": "[email protected]:ZeeCoder/use-resize-observer.git",
7+
"description": "A React hook to use a Resize Observer",
8+
"author": "Viktor Hubert <[email protected]>",
9+
"license": "MIT",
10+
"scripts": {
11+
"build": "rollup -c",
12+
"prepublish": "yarn build"
13+
},
14+
"husky": {
15+
"hooks": {
16+
"pre-commit": "lint-staged"
17+
}
18+
},
19+
"lint-staged": {
20+
"*.{js,md}": [
21+
"prettier --write",
22+
"git add"
23+
]
24+
},
25+
"dependencies": {
26+
"resize-observer": "^1.0.0-alpha.1"
27+
},
28+
"peerDependencies": {
29+
"react": "^16.7.0-alpha.0",
30+
"react-dom": "^16.7.0-alpha.0"
31+
},
32+
"devDependencies": {
33+
"@babel/core": "^7.1.2",
34+
"@babel/preset-env": "^7.1.0",
35+
"husky": "^1.1.2",
36+
"lint-staged": "^7.3.0",
37+
"prettier": "^1.14.3",
38+
"rollup": "^0.66.6",
39+
"rollup-plugin-babel": "^4.0.3"
40+
}
41+
}

rollup.config.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import babel from "rollup-plugin-babel";
2+
3+
export default {
4+
input: "src/index.js",
5+
output: [
6+
{
7+
file: "dist/bundle.cjs.js",
8+
format: "cjs"
9+
},
10+
{
11+
file: "dist/bundle.esm.js",
12+
format: "esm"
13+
}
14+
],
15+
plugins: [babel()],
16+
external: ["react", "resize-observer"]
17+
};

0 commit comments

Comments
 (0)