Skip to content

Commit bfe400f

Browse files
committed
docs: ✏️ add <InfiniteScroll> to docs
1 parent a486bec commit bfe400f

File tree

5 files changed

+33
-2
lines changed

5 files changed

+33
-2
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# libreact
44

5-
[![][npm-badge]][npm-url] [![][travis-badge]][travis-url] [![React Universal Interface](https://img.shields.io/badge/React-Universal%20Interface-green.svg)](https://github.com/streamich/react-universal-interface) [![Backers on Open Collective](https://opencollective.com/libreact/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/libreact/sponsors/badge.svg)](#sponsors)
5+
[![][npm-badge]][npm-url] [![][travis-badge]][travis-url] [![React Universal Interface](https://img.shields.io/badge/React-Universal%20Interface-green.svg)](https://github.com/streamich/react-universal-interface) [![Backers on Open Collective](https://opencollective.com/libreact/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/libreact/sponsors/badge.svg)](#sponsors)
66

77
React standard library&mdash;must-have toolbox for any React project.
88

@@ -90,6 +90,7 @@ const MyComponent = mock();
9090
- [`<Slider>`](./docs/en/Slider.md)
9191
- [`<DropArea>`](./docs/en/DropArea.md)
9292
- [`<Group>`](./docs/en/Group.md)
93+
- [`<InfiniteScroll>`](./docs/en/InfiniteScroll.md)
9394
- [`<OutsideClick>`](./docs/en/OutsideClick.md)
9495
- [`<Ripple>`](./docs/en/Ripple.md) and [`withRipple()`](./docs/en/Ripple.md#withripple) &mdash; [**example**](https://codesandbox.io/s/983q7jr80o)
9596
- [`<Img>`](./docs/en/Img.md)

docs/en/InfiniteScroll.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# `<InfiniteScroll>`
2+
3+
Fires `loadMore` prop when end of content becomes visible.
4+
5+
6+
## Usage
7+
8+
```jsx
9+
import {InfiniteScroll} from 'libreact/lib/InfiniteScroll';
10+
11+
<InfiniteScroll
12+
hasMore={true || false}
13+
cursor={cursor}
14+
loadMore={() => {/* ... */}}
15+
>
16+
{items}
17+
</InfiniteScroll>
18+
```
19+
20+
21+
## Props
22+
23+
- `loadMore` &mdash; required, function that is called when user scrolls to the bottom of the component.
24+
- `cursor` &mdash; required, unique identifier of current page, `loadMore` is called only once for each adjacent unique value of `cursor`.
25+
- `hasMore` &mdash; optional, boolean, whether there are more items to load, if set to `false`, `loadMore` will not be called.
26+
- `sentinel` &mdash; optional, React element to render at the bottom of the component, when this element becomes visible it triggers `loadMore` function, defaults to empty `<div>` pixel.
27+
- `margin` &mdash; optional, number, invisible margin before `sentinel` when to already call `loadMore` before `sentinel` is visible, defaults to `100`.

docs/en/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
- [`<Slider>`](./Slider.md)
5757
- [`<DropArea>`](./DropArea.md)
5858
- [`<Group>`](./Group.md)
59+
- [`<InfiniteScroll>`](./InfiniteScroll.md)
5960
- [`<OutsideClick>`](./OutsideClick.md)
6061
- [`<Ripple>`](./Ripple.md) and [`withRipple()`](./Ripple.md#withripple) &mdash; [**example**](https://codesandbox.io/s/983q7jr80o)
6162
- [`<Img>`](./Img.md)

docs/en/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
* [Ripple](Ripple.md)
7070
* [Img](Img.md)
7171
* [Group](Group.md)
72+
* [InfiniteScroll](InfiniteScroll.md)
7273
* [WidthQuery](WidthQuery.md)
7374
* [View](View.md)
7475
* [WindowWidthQuery](WindowWidthQuery.md)

src/InfiniteScroll/__story__/story.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as React from 'react';
22
import {storiesOf} from '@storybook/react';
33
import {InfiniteScroll} from '..';
4+
import ShowDocs from '../../ShowDocs';
45

56
const h = React.createElement;
67

@@ -51,5 +52,5 @@ class Demo extends React.Component {
5152
}
5253

5354
storiesOf('UI/InfiniteScroll', module)
54-
// .add('Documentation', () => h(ShowDocs, {md: require('../../../docs/en/Lifecycles.md')}))
55+
.add('Documentation', () => h(ShowDocs, {md: require('../../../docs/en/InfiniteScroll.md')}))
5556
.add('Example', () => <Demo />)

0 commit comments

Comments
 (0)