Skip to content

Commit

Permalink
init Observer
Browse files Browse the repository at this point in the history
  • Loading branch information
zombieJ committed Sep 29, 2019
1 parent 37cc04b commit c32e8fb
Show file tree
Hide file tree
Showing 9 changed files with 205 additions and 837 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@ module.exports = {
'react/no-array-index-key': 0,
'react/sort-comp': 0,
'@typescript-eslint/no-explicit-any': 0,
'react/no-find-dom-node': 0,
'jsx-a11y/label-has-associated-control': 0,
'jsx-a11y/label-has-for': 0,
},
};
41 changes: 41 additions & 0 deletions examples/basic.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import '../assets/index.less';
import React from 'react';
import ResizeObserver from '../src';

export default function App() {
const [times, setTimes] = React.useState(0);
const [disabled, setDisabled] = React.useState(false);
const textareaRef = React.useRef<HTMLTextAreaElement>(null);

React.useEffect(() => {
console.log('Ref:', textareaRef.current);
}, []);

const onResize = () => {
setTimes(prevTimes => prevTimes + 1);
};

return (
<React.StrictMode>
<div>
<div>
<label>
<input
type="checkbox"
onChange={() => {
setDisabled(!disabled);
}}
checked={disabled}
/>{' '}
Disabled Observe
</label>
{' >>> '}
<span>Resize times: {times}</span>
</div>
<ResizeObserver onResize={onResize} disabled={disabled}>
<textarea ref={textareaRef} placeholder="I'm a textarea!" />
</ResizeObserver>
</div>
</React.StrictMode>
);
}
110 changes: 0 additions & 110 deletions examples/simple.js

This file was deleted.

119 changes: 0 additions & 119 deletions examples/theme.js

This file was deleted.

18 changes: 10 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "rc-footer",
"name": "rc-resize-observer",
"version": "0.5.0",
"description": "Pretty Footer react component used in used in ant.design",
"description": "Resize observer for React",
"keywords": [
"react",
"react-component",
"react-footer",
"footer",
"react-resize-observer",
"resize-observer",
"antd",
"ant-design"
],
Expand All @@ -19,13 +19,13 @@
"lib",
"dist"
],
"homepage": "https://react-component.github.io/footer",
"homepage": "https://react-component.github.io/resize-observer",
"repository": {
"type": "git",
"url": "git@github.com:react-component/footer.git"
"url": "git@github.com:react-component/resize-observer.git"
},
"bugs": {
"url": "http://github.com/react-component/footer/issues"
"url": "http://github.com/react-component/resize-observer/issues"
},
"license": "MIT",
"scripts": {
Expand All @@ -40,7 +40,9 @@
"coverage": "father test --coverage"
},
"dependencies": {
"classnames": "^2.2.1"
"classnames": "^2.2.1",
"rc-util": "^4.11.1",
"resize-observer-polyfill": "^1.5.1"
},
"devDependencies": {
"@types/classnames": "^2.2.9",
Expand Down
71 changes: 0 additions & 71 deletions src/column.tsx

This file was deleted.

Loading

0 comments on commit c32e8fb

Please sign in to comment.