Skip to content

Commit d4bf2ca

Browse files
committed
docs: refactoring docs to docusaurus
1 parent 2f3ba2c commit d4bf2ca

13 files changed

+96
-103
lines changed

docs/parallax-controller-context.md

Lines changed: 0 additions & 63 deletions
This file was deleted.

documentation/docs/intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ sidebar_position: 1
88

99
React hooks and components to create parallax scroll effects for banners, images or any other DOM elements. Utilizes [Parallax Controller](https://github.com/jscottsmith/parallax-controller) to add vertical or horizontal scrolling based effects to elements. [Optimized](https://parallax-controller.vercel.app/docs/performance) to _reduce_ jank on scroll and works with SSR and SSG rendered React apps.
1010

11-
If you're coming from [V2](https://github.com/jscottsmith/react-scroll-parallax/tree/v2.4.2), here's a [migration guide](https://github.com/jscottsmith/react-scroll-parallax/blob/master/docs/migration-guide.md).
11+
If you're coming from [V2](https://github.com/jscottsmith/react-scroll-parallax/tree/v2.4.2), here's a [migration guide](/docs/usage/migration-guide).
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"label": "Migration Guides",
3+
"position": 2
4+
}

docs/migration-guide.md renamed to documentation/docs/migration-guides/v1-migration-guide.md

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,3 @@
1-
# V2 Migration Guide
2-
3-
With mostly just new features, V3 also makes a few breaking changes. See the following and migrate any code that is affected.
4-
5-
### Renamed Props for \<Parallax\>
6-
7-
If you've used any of the following props simply rename to new ones or refactor if if they are no longer supported.
8-
9-
1. `styleOuter` becomes `style`.
10-
2. `tagOuter` becomes `tag`.
11-
3. `x` becomes `translateX`.
12-
4. `y` becomes `translateY`.
13-
5. `styleInner` is no longer supported - There's only a single element returned by the component.
14-
6. `tagInner` is no longer supported - There's only a single element returned by the component.
15-
16-
### Using the context hook.
17-
18-
The hook to access the parallax controller is now returned directly.
19-
20-
If you used the following:
21-
22-
```js
23-
const { parallaxController } = useController();
24-
```
25-
26-
change it to:
27-
28-
```js
29-
const parallaxController = useController();
30-
```
31-
32-
### Removed default class names
33-
34-
If you relied on either the `parallax-outer` or `parallax-inner` class names for styling you will need to refactor or set them manually.
35-
361
# V1 Migration Guide
372

383
Some breaking changes were introduced in v2. Here's the simple changes that need to be made if you're coming from v1.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# V2 Migration Guide
2+
3+
With mostly just new features, V3 also makes a few breaking changes. See the following and migrate any code that is affected.
4+
5+
### Renamed Props for <Parallax\>
6+
7+
If you've used any of the following props simply rename to new ones or refactor if if they are no longer supported.
8+
9+
1. `styleOuter` becomes `style`.
10+
2. `tagOuter` becomes `tag`.
11+
3. `x` becomes `translateX`.
12+
4. `y` becomes `translateY`.
13+
5. `styleInner` is no longer supported - There's only a single element returned by the component.
14+
6. `tagInner` is no longer supported - There's only a single element returned by the component.
15+
16+
### Using the useController hook.
17+
18+
The hook to access the parallax controller is now returned directly.
19+
20+
If you used the following:
21+
22+
```js
23+
const { parallaxController } = useController();
24+
```
25+
26+
change it to:
27+
28+
```js
29+
const parallaxController = useController();
30+
```
31+
32+
### Removed default class names
33+
34+
If you relied on either the `parallax-outer` or `parallax-inner` class names for styling you will need to refactor or set them manually.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"label": "Usage",
3+
"position": 1
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"label": "Components",
3+
"position": 2
4+
}

docs/parallax-banner-component.md renamed to documentation/docs/usage/components/parallax-banner-component.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# \<ParallaxBanner>
1+
# ParallaxBanner
22

33
Component that utilizes `<Parallax>` components to achieve a parallaxing banner effect. Allows a single or multiple images to be parallaxed at different rates within the banner area.
44

docs/parallax-component.md renamed to documentation/docs/usage/components/parallax-component.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# \<Parallax>
1+
# Parallax
22

33
The main component for applying scroll effects based on an elements position within the viewport.
44

docs/parallax-provider-component.md renamed to documentation/docs/usage/components/parallax-provider.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# \<ParallaxProvider>
1+
# ParallaxProvider
22

33
The `<ParallaxProvider />` component is meant to wrap a top level component in your application and is necessary to provide access though React context API to the parallax controller. This component should only be used once in you app, for instance in an `<AppContainer />` component that won't be mounted/unmounted during route changes. Like so:
44

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"label": "Hooks",
3+
"position": 1
4+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# useController
2+
3+
This hook provides you access to the [`ParallaxController`](https://parallax-controller.vercel.app/docs/api/parallax-controller/) via [React context](https://facebook.github.io/react/docs/context.html). The hook must be called in a component rendered within the [`<ParallaxProvider>`](/docs/usage/components/parallax-provider). The most common usage of the controller is to update cache if the page layout has changed.
4+
5+
## Example Usage For Images
6+
7+
Updating the `ParallaxController` cache once an image loads:
8+
9+
```tsx
10+
import { useController } from 'react-scroll-parallax';
11+
12+
function Image(props) {
13+
const parallaxController = useController();
14+
15+
// updates cached values after image dimensions have loaded
16+
const handleLoad = () => parallaxController.update();
17+
18+
return <img src={props.src} onLoad={handleLoad} />;
19+
}
20+
```
21+
22+
## Example Route Change Hook
23+
24+
Another common use case is the need to update cache after a route changes. This custom hook updates the controller each time the location changes.
25+
26+
```tsx
27+
function useUpdateControllerOnRouteChange() {
28+
const location = useLocation();
29+
const parallaxController = useController();
30+
31+
useEffect(() => {
32+
parallaxController.update();
33+
}, [location.pathname]);
34+
}
35+
```
36+
37+
### Parallax Controller
38+
39+
See the `parallax-controller` [documentation](https://parallax-controller.vercel.app/docs/api/parallax-controller/) of all the methods that can be called from the controller

docs/use-parallax-hook.md renamed to documentation/docs/usage/hooks/use-parallax.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# Hook useParallax()
1+
# useParallax
2+
3+
Main hook for applying parallax effects to a DOM element. Any of the documented [effects and configurations](https://parallax-controller.vercel.app/docs/usage/props) can be passed as params to the hook.
24

35
## Example Usage
46

0 commit comments

Comments
 (0)