Skip to content

Commit cbcc467

Browse files
committed
add scale story
1 parent 60b40be commit cbcc467

File tree

4 files changed

+45
-5
lines changed

4 files changed

+45
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
}
7474
],
7575
"dependencies": {
76-
"parallax-controller": "0.1.10"
76+
"parallax-controller": "0.1.11"
7777
},
7878
"devDependencies": {
7979
"@babel/core": "^7.16.0",

src/components/Parallax.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,18 @@ export interface ParallaxProps {
8484
* Second value is the ending rotation
8585
*/
8686
rotateZ?: string[] | number[];
87+
88+
/**
89+
* Start and end scale on x-axis and y-axis.
90+
*
91+
* Example:
92+
*
93+
* scale={[0, 1]}
94+
*
95+
* First value is the starting scale
96+
* Second value is the ending scale
97+
*/
98+
scale?: number[];
8799
/**
88100
* Optionally pass additional class names to be added to the outermost parallax element.
89101
*/
@@ -163,6 +175,7 @@ export function Parallax(props: PropsWithChildren<ParallaxProps>) {
163175
rotateX: props.rotateX,
164176
rotateY: props.rotateY,
165177
rotateZ: props.rotateZ,
178+
scale: props.scale,
166179
}),
167180
};
168181
}
@@ -197,6 +210,7 @@ export function Parallax(props: PropsWithChildren<ParallaxProps>) {
197210
props.rotateX,
198211
props.rotateY,
199212
props.rotateZ,
213+
props.scale,
200214
props.speed,
201215
]);
202216

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import React from 'react';
2+
import { Parallax } from '../../src';
3+
import { Element } from '../Element/Element';
4+
import { Container } from '../Container';
5+
import styles from './Parallax.module.scss';
6+
7+
const Template = (args) => {
8+
const props = args;
9+
return (
10+
<Container scrollAxis="vertical" className={styles.elements}>
11+
<Parallax {...props} className={styles.parallax}>
12+
<Element name="A" />
13+
</Parallax>
14+
</Container>
15+
);
16+
};
17+
18+
export const WithScale = Template.bind({});
19+
WithScale.args = {
20+
scale: [0, 1],
21+
};
22+
23+
export default {
24+
title: '<Parallax> Scale',
25+
component: WithScale,
26+
};

yarn.lock

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

10156-
parallax-controller@0.1.10:
10157-
version "0.1.10"
10158-
resolved "https://registry.yarnpkg.com/parallax-controller/-/parallax-controller-0.1.10.tgz#47071d9ac4bd30ae2a0aabfe8b11fde20616ee64"
10159-
integrity sha512-aV4arXEiKfhbaBtg95t1OHr9fJ+rlhjZUfmbu5BwG1LTVThBQH0ZrTdu1aZVwJv9yUjFThCFuB/vkP9ZquNkzQ==
10156+
parallax-controller@0.1.11:
10157+
version "0.1.11"
10158+
resolved "https://registry.yarnpkg.com/parallax-controller/-/parallax-controller-0.1.11.tgz#405a48fcb912f4f914567d794b0224f9aca09b45"
10159+
integrity sha512-mT6H3A8oz/LctdwSN2sPMqsos1orD9jwkB5m0n5v5XDTYJgOGAA/rypAf2cEZ34J2z4NUIzgd5o07RBUKiA9xA==
1016010160

1016110161
parallel-transform@^1.1.0:
1016210162
version "1.2.0"

0 commit comments

Comments
 (0)