Skip to content

Commit 94a59f8

Browse files
authored
* working on v3 * more update animation key frames * update with animate key frames * working on aniamteGroup * draft version * update * delete unused files * delete unused files * fixing useAnimate * fixing useAnimate * update all the hooks * update * covert to flow to typescript * get it working with typescript * remove all unit tests * fix types * type clean up * move type update * fix bug on animate group * update on unit tests * more unit tests update * unit test for animateGroup * unit test for AnimateKeyFrames * useAnimateGroup * testing on useAnimateGroup * working version with useAnimateGroup * fix unit test * fix unit test * unit test for useAnimateGroup * update readme * update readme * update readme * update readme
1 parent c67c820 commit 94a59f8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+2641
-4857
lines changed

.babelrc

-8
This file was deleted.

.eslintrc

-26
This file was deleted.

.eslintrc.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = {
2+
parser: '@typescript-eslint/parser',
3+
extends: ['plugin:@typescript-eslint/recommended'],
4+
parserOptions: {
5+
ecmaVersion: 2018,
6+
sourceType: 'module',
7+
},
8+
rules: {
9+
'@typescript-eslint/indent': 'off'
10+
},
11+
};

.flowconfig

-12
This file was deleted.

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ typings/
6161

6262
.DS_Store
6363

64+
/dist
6465
/lib
6566
.idea/
66-
.coveralls.yml
67+
.coveralls.yml
68+
.rpt2_cache/

README.md

+67-21
Original file line numberDiff line numberDiff line change
@@ -24,35 +24,81 @@
2424

2525
## Quickstart
2626

27-
```jsx
28-
import react from 'react';
29-
import { Animate, AnimateKeyframes, AnimateGroup } from 'react-simple-animate';
27+
#### Components
3028

31-
const props = {
32-
startStyle: { opacity: 0 }
33-
endStyle: { opacity: 1 }
34-
};
29+
```jsx
30+
import React from "react";
31+
import { Animate, AnimateKeyframes, AnimateGroup } from "react-simple-animate";
3532

36-
export default () => {
37-
return (
38-
// This example demonstrate animate individual element.
39-
<Animate play {...props}>
33+
export default () => (
34+
<>
35+
{/* This example demonstrate animate individual element. */}
36+
<Animate play start={{ opacity: 0 }} end={{ opacity: 1 }}>
4037
<h1>React simple animate</h1>
4138
</Animate>
42-
43-
// This example demonstrate animate keyframes with individual element.
44-
<AnimateKeyframes play iterationCount="infinite" keyframes={['opacity: 0', 'opacity: 1']}>
39+
{/* This example demonstrate animate keyframes with individual element. */}
40+
<AnimateKeyframes
41+
play
42+
iterationCount="infinite"
43+
keyframes={["opacity: 0", "opacity: 1"]}
44+
>
4545
<h1>React simple animate with keyframes</h1>
4646
</AnimateKeyframes>
47-
48-
// This example demonstrate animate group of animation with sequenceIndex.
47+
{/* This example demonstrate animate group of animation with sequenceIndex. */}
4948
<AnimateGroup play>
50-
<Animate {...props} sequenceIndex={0} />
51-
<p>Next animation below: </p>
52-
<Animate {...props} sequenceIndex={1} />
53-
<p>Final animation below: </p>
54-
<Animate {...props} sequenceIndex={2} />
49+
<Animate start={{ opacity: 0 }} end={{ opacity: 1 }} sequenceIndex={0}>
50+
first
51+
</Animate>
52+
53+
<Animate start={{ opacity: 0 }} end={{ opacity: 1 }} sequenceIndex={1}>
54+
second
55+
</Animate>
56+
<Animate start={{ opacity: 0 }} end={{ opacity: 1 }} sequenceIndex={2}>
57+
third
58+
</Animate>
5559
</AnimateGroup>
60+
</>
61+
);
62+
63+
```
64+
65+
#### Hooks
66+
67+
```jsx
68+
import react from 'react';
69+
import { useAnimate, useAnimateKeyframes, useAnimateGroup } from 'react-simple-animate';
70+
71+
export const useAnimateExample = () => {
72+
const { style, play } = useAnimate({ start: { opacity: 0 }, end: { opacity: 1 } });
73+
74+
useEffect(() => play(true), []);
75+
76+
return <div style={style}>useAnimate</div>;
77+
};
78+
79+
export const useAnimateKeyframesExample = () => {
80+
const { style, play } = useAnimateKeyframes({
81+
keyframes: ['opacity: 0', 'opacity: 1'],
82+
iterationCount: 4
83+
});
84+
85+
useEffect(() => play(true), []);
86+
87+
return <div style={style}>useAnimate</div>;
88+
};
89+
90+
export const useAnimateGroup = () => {
91+
const { styles = [], play } = useAnimateGroup({
92+
sequences: [
93+
{ start: { opacity: 1 }, end: { opacity: 0 } },
94+
{ start: { background: "red" }, end: { background: "blue" } }
95+
]
96+
});
97+
98+
useEffect(() => play(true), []);
99+
100+
return (
101+
{styles.map(style => <div style={style}>useAnimateGroup</div>)}
56102
);
57103
};
58104
```

index.d.ts

-130
This file was deleted.

jest.config.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module.exports = {
2+
roots: ['<rootDir>/src'],
3+
transform: {
4+
'^.+\\.tsx?$': 'ts-jest',
5+
},
6+
globals: {
7+
'ts-jest': {
8+
tsConfig: 'tsconfig.jest.json',
9+
},
10+
},
11+
testMatch: ['**/?(*.)+(spec|test).ts?(x)'],
12+
transformIgnorePatterns: ['[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$'],
13+
setupFiles: ['<rootDir>/setup.ts'],
14+
moduleFileExtensions: ['ts', 'tsx', 'js'],
15+
};

jestConfig.json

-3
This file was deleted.

0 commit comments

Comments
 (0)