Skip to content

Commit 97a542a

Browse files
committed
chore: rename useController to useParallaxController
1 parent 5f1c45c commit 97a542a

File tree

14 files changed

+40
-31
lines changed

14 files changed

+40
-31
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ yarn add react-scroll-parallax@beta
4141
### Docs: Hooks
4242

4343
- [`useParallax()`](https://react-scroll-parallax.v3.damnthat.tv/docs/usage/hooks/use-parallax)
44-
- [`useController()`](https://react-scroll-parallax.v3.damnthat.tv/docs/usage/hooks/use-controller)
44+
- [`useParallaxController()`](https://react-scroll-parallax.v3.damnthat.tv/docs/usage/hooks/use-parallax-controller)
4545

4646
### Docs: Components
4747

documentation/docs/intro.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ yarn add react-scroll-parallax@beta
5050
### Docs: Hooks
5151

5252
- [`useParallax()`](/docs/usage/hooks/use-parallax)
53-
- [`useController()`](/docs/usage/hooks/use-controller)
53+
- [`useParallaxController()`](/docs/usage/hooks/use-controller)
5454

5555
### Docs: Components
5656

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
sidebar_position: 2
3+
---
4+
15
# V1 Migration Guide
26

37
Some breaking changes were introduced in v2. Here's the simple changes that need to be made if you're coming from v1.

documentation/docs/migration-guides/v2-migration-guide.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
---
2+
sidebar_position: 1
3+
---
4+
15
# V2 Migration Guide
26

37
With mostly just new features, V3 also makes a few breaking changes. See the following and migrate any code that is affected.
48

59
### Prop changes for <Parallax\>
610

7-
If you've used any of the following props simply rename to new ones or refactor if if they are no longer supported.
11+
If you've used any of the following props rename to new ones, or refactor if they are no longer supported.
812

913
1. `styleOuter` becomes `style`.
1014
2. `tagOuter` becomes `tag`.
@@ -15,7 +19,8 @@ If you've used any of the following props simply rename to new ones or refactor
1519

1620
### Using the useController hook.
1721

18-
The hook to access the parallax controller is now returned directly.
22+
1. The hook `useController` has been renamed to `useParallaxController`.
23+
2. The hook returns the instance of the controller directly.
1924

2025
If you used the following:
2126

@@ -26,7 +31,7 @@ const { parallaxController } = useController();
2631
change it to:
2732

2833
```js
29-
const parallaxController = useController();
34+
const parallaxController = useParallaxController();
3035
```
3136

3237
### Removed default class names

documentation/docs/usage/hooks/hooks.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ All provided React hooks.
44

55
```ts
66
import { useParallax } from 'react-scroll-parallax';
7-
import { useController } from 'react-scroll-parallax';
7+
import { useParallaxController } from 'react-scroll-parallax';
88
```
99

1010
## Documentation
1111

1212
- [`useParallax()`](/docs/usage/hooks/use-parallax)
13-
- [`useController()`](/docs/usage/hooks/use-controller)
13+
- [`useParallaxController()`](/docs/usage/hooks/use-parallax-controller)

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# useController
1+
# useParallaxController
22

33
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.
44

@@ -7,10 +7,10 @@ This hook provides you access to the [`ParallaxController`](https://parallax-con
77
Updating the `ParallaxController` cache once an image loads:
88

99
```tsx
10-
import { useController } from 'react-scroll-parallax';
10+
import { useParallaxController } from 'react-scroll-parallax';
1111

1212
function Image(props) {
13-
const parallaxController = useController();
13+
const parallaxController = useParallaxController();
1414

1515
// updates cached values after image dimensions have loaded
1616
const handleLoad = () => parallaxController.update();
@@ -26,7 +26,7 @@ Another common use case is the need to update cache after a route changes. This
2626
```tsx
2727
function useUpdateControllerOnRouteChange() {
2828
const location = useLocation();
29-
const parallaxController = useController();
29+
const parallaxController = useParallaxController();
3030

3131
useEffect(() => {
3232
parallaxController.update();

documentation/docs/usage/usage.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@ Depending on your app setup, you may need to update the [Parallax Controller](ht
8888
```tsx
8989
import { useEffect } from 'react';
9090
import { useLocation } from '@reach/router';
91-
import { useController } from 'react-scroll-parallax';
91+
import { useParallaxController } from 'react-scroll-parallax';
9292

9393
function useUpdateControllerOnRouteChange() {
9494
const location = useLocation();
95-
const parallaxController = useController();
95+
const parallaxController = useParallaxController();
9696

9797
useEffect(() => {
9898
parallaxController.update();
@@ -110,10 +110,10 @@ const ParallaxRouteUpdate = () => {
110110
Often times images impact the position of content on the page. This is another common scenario that will require updating the cache which can be done using an `onLoad` event.
111111

112112
```tsx
113-
import { useController } from 'react-scroll-parallax';
113+
import { useParallaxController } from 'react-scroll-parallax';
114114

115115
const Image = () => {
116-
const parallaxController = useController();
116+
const parallaxController = useParallaxController();
117117
return <img src="image.jpg" onLoad={() => parallaxController.update()} />;
118118
};
119119
```

documentation/src/css/tailwind-custom-base.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,13 +313,13 @@ legend {
313313
padding: 0;
314314
}
315315

316-
ol,
316+
/* ol,
317317
ul,
318318
menu {
319319
list-style: none;
320320
margin: 0;
321321
padding: 0;
322-
}
322+
} */
323323

324324
/*
325325
Prevent resizing textareas horizontally by default.

src/components/ParallaxProvider/index.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { ParallaxController } from 'parallax-controller';
66

77
import { render } from '@testing-library/react';
88
import { ParallaxProvider } from '.';
9-
import { useController } from '../../hooks/useController';
9+
import { useParallaxController } from '../../hooks/useParallaxController';
1010

1111
describe('A <ParallaxProvider>', () => {
1212
it('to render children', () => {
@@ -35,7 +35,7 @@ describe('A <ParallaxProvider>', () => {
3535
let parallaxController;
3636

3737
const ContextChecker = () => {
38-
parallaxController = useController();
38+
parallaxController = useParallaxController();
3939
return null;
4040
};
4141

src/hooks/useParallax.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import { useEffect, useRef, useState } from 'react';
33
import { useVerifyController } from '../components/Parallax/hooks';
44
import { getParallaxProps } from '../helpers/getParallaxProps';
55
import { ParallaxProps } from '../types';
6-
import { useController } from './useController';
6+
import { useParallaxController } from './useParallaxController';
77

88
export function useParallax<T extends HTMLElement>(props: ParallaxProps) {
9-
const controller = useController();
9+
const controller = useParallaxController();
1010
const ref = useRef<T>(null);
1111

1212
useVerifyController(controller);

0 commit comments

Comments
 (0)