Skip to content

Commit 19dedef

Browse files
committed
upgrade controller, remove el outer
1 parent fc90170 commit 19dedef

File tree

4 files changed

+9
-14
lines changed

4 files changed

+9
-14
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
}
8484
],
8585
"dependencies": {
86-
"parallax-controller": "^1.0.0"
86+
"parallax-controller": "^1.0.3"
8787
},
8888
"devDependencies": {
8989
"@babel/core": "^7.16.0",

src/components/Parallax/index.test.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ describe('Expect the <Parallax> component', () => {
7373
);
7474

7575
expect(controller.createElement).toBeCalledWith({
76-
elInner: expect.any(HTMLElement),
77-
elOuter: expect.any(HTMLElement),
76+
el: expect.any(HTMLElement),
7877
props: { disabled: false, translateY: [-100, 100] },
7978
});
8079
});
@@ -101,8 +100,7 @@ describe('Expect the <Parallax> component', () => {
101100
});
102101

103102
expect(controller.createElement).toBeCalledWith({
104-
elInner: expect.any(HTMLElement),
105-
elOuter: expect.any(HTMLElement),
103+
el: expect.any(HTMLElement),
106104
props: { disabled: false, rotate: ['0deg', '100deg'] },
107105
});
108106
});

src/components/Parallax/index.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { useVerifyController } from './hooks';
88
export function Parallax(props: PropsWithChildren<ParallaxProps>) {
99
const controller = useController();
1010
const refInner = useRef<HTMLElement>();
11-
const refOuter = useRef<HTMLElement>();
1211

1312
useVerifyController(controller);
1413

@@ -36,9 +35,7 @@ export function Parallax(props: PropsWithChildren<ParallaxProps>) {
3635

3736
return {
3837
// @ts-expect-error
39-
elInner: refInner.current,
40-
// @ts-expect-error
41-
elOuter: refOuter.current,
38+
el: refInner.current,
4239
props: removeUndefinedObjectKeys({
4340
translateX,
4441
translateY,
@@ -120,7 +117,7 @@ export function Parallax(props: PropsWithChildren<ParallaxProps>) {
120117
const Inner = props.innerTag;
121118

122119
return (
123-
<Outer className={props.className} ref={refOuter} style={props.style}>
120+
<Outer className={props.className} style={props.style}>
124121
<Inner
125122
className={props.innerClassName}
126123
ref={refInner}

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10913,10 +10913,10 @@ pako@~1.0.5:
1091310913
resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.11.tgz#6c9599d340d54dfd3946380252a35705a6b992bf"
1091410914
integrity sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==
1091510915

10916-
parallax-controller@^1.0.0:
10917-
version "1.0.1"
10918-
resolved "https://registry.yarnpkg.com/parallax-controller/-/parallax-controller-1.0.1.tgz#6194c6f62d9c44490fa8a146d94fb91cf10c4120"
10919-
integrity sha512-1A+aVtkHSX1vNOpMLJ76WbEk2U0Bkw5UdioQ8hQIYdWw7hvLSCS71UtIevl6XdzYgl00T3kk90N0zKNDSRz+yw==
10916+
parallax-controller@^1.0.3:
10917+
version "1.0.3"
10918+
resolved "https://registry.yarnpkg.com/parallax-controller/-/parallax-controller-1.0.3.tgz#db67d90222130f959ad3d110d8a68c65bcd561ca"
10919+
integrity sha512-P9DoUV/vh7Ipt+RNwUdmRyV6gA7eTfYg/7RmQovIsEEYL7uHRUE96KBDJabMZElw3/3TjrC52/m+ZlBF0ZekEw==
1092010920
dependencies:
1092110921
bezier-easing "^2.1.0"
1092210922

0 commit comments

Comments
 (0)