Skip to content

Commit bd47797

Browse files
committed
🚀 RELEASE: github pages, update docs
1 parent 131606d commit bd47797

File tree

7 files changed

+393
-36
lines changed

7 files changed

+393
-36
lines changed

README.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
[![License MIT](https://img.shields.io/badge/license-MIT-orange.svg?style=flat)](https://raw.githubusercontent.com/pettiboy/react-ui-scrollspy/main/LICENSE)
77
[![PRs Welcome](https://img.shields.io/badge/PRs-Welcome-brightgreen.svg)](https://github.com/pettiboy/react-ui-scrollspy/pulls)
88

9-
![](https://img.shields.io/badge/React-20232A?style=for-the-badge&logo=react&logoColor=61DAFB)
10-
![](https://img.shields.io/badge/TypeScript-007ACC?style=for-the-badge&logo=typescript&logoColor=white)
11-
![](https://img.shields.io/badge/npm-CB3837?style=for-the-badge&logo=npm&logoColor=white)
9+
![React](https://img.shields.io/badge/React-20232A?style=for-the-badge&logo=react&logoColor=61DAFB)
10+
![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?style=for-the-badge&logo=typescript&logoColor=white)
11+
![NPM](https://img.shields.io/badge/npm-CB3837?style=for-the-badge&logo=npm&logoColor=white)
1212

1313
</div>
1414

@@ -24,6 +24,12 @@ OR
2424
yarn add react-ui-scrollspy
2525
```
2626

27+
## 🎞 Demo
28+
29+
### Try it your self [here](https://pettiboy.github.io/react-ui-scrollspy)!
30+
31+
![ScrollSpy Demo](./demo-app/assets/demo.gif)
32+
2733
## ⚙️ Usage
2834

2935
1. In your navigation component
@@ -66,41 +72,43 @@ import ScrollSpy from "react-ui-scrollspy";
6672
}
6773
```
6874

75+
`NOTE:` See [`demo-app`](./demo-app/src/App.tsx) for example used [here](https://pettiboy.github.io/react-ui-scrollspy).
76+
6977
## 💡 Props
7078

71-
### Children
79+
### 🔧 Children
7280

7381
| Attributes | Type | Description | Default | Required |
7482
| :--------- | :---------- | :------------------------------------------------- | :------ | :------- |
7583
| `children` | `ReactNode` | Each direct child `Element` should contain an `id` | - | yes |
7684

77-
### Refs
85+
### 🔧 Refs
7886

7987
| Attributes | Type | Description | Default | Required |
8088
| :------------------------- | :------------------------------------------------ | :---------------------------------------------------------------------------------------------------------------- | :------ | :------- |
8189
| `navContainerRef` | MutableRefObject<br><HTMLDivElement \| null><br/> | `ref` to your navigation container containing items with `data-to-scrollspy-id` attributes | - | no |
8290
| `parentScrollContainerRef` | MutableRefObject<br><HTMLDivElement \| null><br/> | If you want to spy only on a particular scrollable `container (Element)` then pass a ref of the same to this prop | - | no |
8391

84-
### Throlle
92+
### 🔧 Throlle
8593

8694
| Attributes | Type | Description | Default | Required |
8795
| :--------------- | :------- | :--------------------------------------------------------------------------------------------------------------------- | :------ | :------- |
8896
| `scrollThrottle` | `number` | In `milliseconds` to throttle the `onscroll` event. Lower the number, better the response, higher the performance cost | `300` | no |
8997

90-
### Callback
98+
### 🔧 Callback
9199

92100
| Attributes | Type | Description | Default | Required |
93101
| :----------------- | :--------------------- | :-------------------------------------------------------------------------------------------------------------- | :------ | :------- |
94102
| `onUpdateCallback` | `(id: string) => void` | Executes this function whenever you scroll to an `Element`, callback returns the `id` of that `Element` as well | - | no |
95103

96-
### Offsets
104+
### 🔧 Offsets
97105

98106
| Attributes | Type | Description | Default | Required |
99107
| :------------- | :------- | :-------------------------------------------------------------------------------------------------------------- | :------ | :------- |
100108
| `offsetTop` | `number` | Spy will be fired when it has been scrolled `offsetTop` beyond `50%` to the top of the containing element | `0` | no |
101109
| `offsetBottom` | `number` | Spy will be fired when it has been scrolled `offsetBottom` beyond `50%` to the bottom of the containing element | `0` | no |
102110

103-
### Customize Attributes
111+
### 🔧 Customize Attributes
104112

105113
| Attributes | Type | Description | Default | Required |
106114
| :----------------- | :------- | :----------------------------------------------------------- | :-------------------- | :------- |

demo-app/assets/demo.gif

4.63 MB
Loading

0 commit comments

Comments
 (0)