Skip to content

Commit db43369

Browse files
author
Muhammet Ozturk
committed
- update to readme.md
1 parent ebeb712 commit db43369

File tree

2 files changed

+35
-7
lines changed

2 files changed

+35
-7
lines changed

README.md

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,21 +85,43 @@ const devices = [
8585

8686
## Example Gifs
8787
- Middle
88-
![](middle.gif)
88+
![](middle.gif)
8989

9090
- Small
91-
![](small.gif)
91+
![](small.gif)
9292

9393
- Full
94-
![](full.gif)
94+
![](full.gif)
9595

9696
Live : http://panoramic-cake.surge.sh/
97+
98+
## Default devices
99+
```javascript
100+
const devices: [
101+
// below 768px
102+
{
103+
name: 'mobile',
104+
breakpointPx: 768,
105+
},
106+
// 768px - 991px
107+
{
108+
name: 'tablet',
109+
breakpointPx: 992,
110+
},
111+
// 992px - 1200px
112+
{
113+
name: 'computer',
114+
breakpointPx: 1200,
115+
},
116+
]
117+
```
97118

98119
## API
99120

100121
| Prop | Type | Description | Default |
101122
| ------------------ | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------- |
102123
| onChangeType | Func | Function that will be invoked with `name` and `lastBreakpointPx` arguments | n/a |
124+
| devices | array | Define values| {name: 'mobile', breakpointPx: 768},{name: 'tablet', breakpointPx: 992}, {name: 'computer', breakpointPx: 1200}|
103125
| skipOnMount | Bool | Do not trigger onChangeType when a component mounts | `false` |
104126
| resizableElementId | String | Id of the element we want to observe. If none provided, parentElement of the component will be used | `undefined` |
105127
| refreshMode | String | Possible values: `throttle` and `debounce` See [lodash docs](https://lodash.com/docs#debounce) for more information. `undefined` - means that callback will be fired as often as ResizeObserver allows | `undefined` |

src/lib/ElementBasedDeviceDedector.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class ElementBasedDeviceDedector extends PureComponent {
4141
};
4242

4343
render() {
44-
const { refreshRate, ...otherProps } = this.props;
44+
const { devices, ...otherProps } = this.props;
4545
return <ReactResizeDetector handleWidth onResize={this.onResize} {...otherProps} />;
4646
}
4747
}
@@ -58,19 +58,25 @@ ElementBasedDeviceDedector.propTypes = {
5858

5959
ElementBasedDeviceDedector.defaultProps = {
6060
devices: [
61+
// below 768px
6162
{
6263
name: 'mobile',
63-
breakpointPx: 500,
64+
breakpointPx: 768,
6465
},
66+
// 768px - 991px
6567
{
6668
name: 'tablet',
67-
breakpointPx: 720,
69+
breakpointPx: 992,
6870
},
71+
// 992px - 1200px
6972
{
7073
name: 'computer',
71-
breakpointPx: 900,
74+
breakpointPx: 1200,
7275
},
7376
],
7477
};
7578

7679
export default ElementBasedDeviceDedector;
80+
81+
82+

0 commit comments

Comments
 (0)