Skip to content

Commit a7ed2c3

Browse files
committed
chore: docs
1 parent 9cf2755 commit a7ed2c3

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

README.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
The `useSmoothScroll` hook finish smooth scroll behaviour in react component by `requestAnimationFrame`.
88

9-
**Storybook Docs are <a target="_blank" href="https://ron0115.best/react-smooth-scroll-hook/?path=/docs/main-usesmoothscroll--docs" >Here</a>.**
9+
> **Storybook Docs are <a target="_blank" href="https://ron0115.best/react-smooth-scroll-hook/?path=/docs/main-usesmoothscroll--docs" >Here</a>.**
1010
1111
## Feature
1212

@@ -24,8 +24,6 @@ npm install react-smooth-scroll-hook
2424

2525
## useSmoothScroll
2626

27-
**Live demo is <a target="_blank" href="https://codesandbox.io/s/usesmoothscroll-2zt20?file=/Body.stories.tsx" >Here</a>.**(Codesandbox)
28-
2927
### Quick Start
3028

3129
```tsx
@@ -93,17 +91,22 @@ export const Demo = () => {
9391

9492
- **refreshSize** `() => void`: Manually refresh the size of ref container, possibly useful in some situation.
9593

94+
### Demo
95+
96+
- **<a target="_blank" href="https://codesandbox.io/s/usesmoothscroll-2zt20?file=/Body.stories.tsx" >CodeSandbox</a>**
97+
- **<a target="_blank" href="https://ron0115.best/react-smooth-scroll-hook/?path=/docs/main-usesmoothscroll--docs" >Storybook</a>**
98+
9699
## useScrollWatch
97100

98101
Proviede a `list` of dom like below, and pass the parent container `ref` to hook, it return the scrollbar current state of `scrollTop`, `curIndex`, `curItem`.
99102

100-
**Live demo is <a target="_blank" href="https://codesandbox.io/s/gifted-field-5b3ui?file=/UseScrollWatch.stories.tsx:9-24" >Here</a>.**(Codesandbox)
101-
102103
### Quick Start
103104

104105
```tsx
106+
import React, { useRef } from 'react';
107+
import { useScrollWatch } from 'react-smooth-scroll-hook';
105108
export const ScrollConatainerMode = () => {
106-
const ref = useRef<HTMLDivElement>(null);
109+
const ref = useRef(null);
107110
const { scrollTop, curIndex, curItem } = useScrollWatch({
108111
ref,
109112
list: [
@@ -153,8 +156,6 @@ export const ScrollConatainerMode = () => {
153156
};
154157
```
155158

156-
> Click <a href="https://ron0115.best/react-smooth-scroll-hook/?path=/docs/hook-usescrollwatch--docs" target="_blank">Here</a> to know more and see Demo.
157-
158159
### Props
159160

160161
- **list** `Array({href, offset})`: `href` is elemet selector string, which passing to `querySelector`, such as `#element-id`
@@ -165,3 +166,8 @@ export const ScrollConatainerMode = () => {
165166
- **scrollTop** `number`: current scrollTop of scroll container.
166167
- **curIndex** `number`: current Index of list
167168
- **curItem** `{href, offset}`: current Item of list
169+
170+
### Demo
171+
172+
- **<a target="_blank" href="https://codesandbox.io/s/gifted-field-5b3ui?file=/UseScrollWatch.stories.tsx:9-24" >CodeSandbox</a>**
173+
- **<a target="_blank" href="https://ron0115.best/react-smooth-scroll-hook/?path=/docs/more-usescrollwatch--docs" >Storybook</a>**

0 commit comments

Comments
 (0)