Skip to content

Commit 0778743

Browse files
committed
Fixed “createAnimatableComponent” HOC by adding missing “animation” prop.
1 parent 9dcfd90 commit 0778743

File tree

7 files changed

+26
-14
lines changed

7 files changed

+26
-14
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [1.1.7] - 2020-04-25
10+
### Fixed
11+
- Fixed `createAnimatableComponent` HOC by adding missing `animation` prop.
12+
913
## [1.1.6] - 2020-04-25
1014
### Fixed
1115
- Fixed query selector for `animatable-cube` component, to avoid removing styles when `fromClassName` or `toClassName` props are used.
@@ -56,7 +60,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5660
- Added GitHub page with Google Analytics to track some events.
5761
- Added README with instructions to integrate the Web component with any other framework (Angular, React, Vue, etc).
5862

59-
[Unreleased]: https://github.com/proyecto26/animatable-component/compare/v1.1.6...HEAD
63+
[Unreleased]: https://github.com/proyecto26/animatable-component/compare/v1.1.7...HEAD
64+
[1.1.7]: https://github.com/proyecto26/animatable-component/compare/v1.1.6...v1.1.7
6065
[1.1.6]: https://github.com/proyecto26/animatable-component/compare/v1.1.5...v1.1.6
6166
[1.1.5]: https://github.com/proyecto26/animatable-component/compare/v1.1.4...v1.1.5
6267
[1.1.4]: https://github.com/proyecto26/animatable-component/compare/v1.1.3...v1.1.4

demo-pwa/src/components/app-home/app-home.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import {
33
EASING,
44
ANIMATIONS,
55
AnimationsType,
6-
EasingType
6+
EasingType,
7+
createAnimatableComponent
78
} from '@proyecto26/animatable-component';
89

910
const animations = Object.keys(ANIMATIONS);
@@ -27,6 +28,10 @@ const fillModes: Array<FillMode> = [
2728
'none'
2829
];
2930

31+
const AnimatableImg = createAnimatableComponent(() => (
32+
<div class='img'></div>
33+
))
34+
3035
@Component({
3136
tag: 'app-home',
3237
styleUrl: 'app-home.css'
@@ -61,7 +66,7 @@ export class AppHome {
6166
<ion-card-title>Demo</ion-card-title>
6267
</ion-card-header>
6368
<ion-card-content class="ion-text-center">
64-
<animatable-component
69+
<AnimatableImg
6570
ref={el => this.animatableEl = el}
6671
autoPlay
6772
animation={this.animation}
@@ -75,8 +80,7 @@ export class AppHome {
7580
fromClassName={this.fromClassName}
7681
toClassName={this.toClassName}
7782
>
78-
<div class='img'></div>
79-
</animatable-component>
83+
</AnimatableImg>
8084
<ion-buttons class="ion-justify-content-center ion-padding">
8185
<ion-fab-button
8286
color='medium'

img/demo-pwa.png

109 KB
Loading

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@proyecto26/animatable-component",
3-
"version": "1.1.6",
3+
"version": "1.1.7",
44
"private": false,
55
"description": "Animate once, use Everywhere! 💫",
66
"author": "Proyecto 26",

readme.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ Do you want to see this web component in action? Visit https://codepen.io/jdnich
4343
- WorkShop: https://slides.com/juandavidnicholls/waapi-webcomponents
4444
- Meet `<animatable />`, a tiny Web Component: https://dev.to/jdnichollsc/meet-animatable-a-tiny-web-component-to-use-web-animations-api-as-a-component-1glh
4545

46-
![Animatable](https://github.com/proyecto26/animatable-component/blob/master/img/animatable.png?raw=true)
46+
![Animatable](https://github.com/proyecto26/animatable-component/blob/master/img/demo-pwa.png?raw=true)
47+
> Includes a PWA demo for debugging animations!
4748
4849
## Usage 🎉
4950

src/hocs/index.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export function createAnimatableComponent<Props> (
1919
return (props: ComponentProps): FunctionalComponent<ComponentProps> => {
2020
const {
2121
ref,
22+
animation,
2223
keyFrames,
2324
keyFramesData,
2425
options,
@@ -35,18 +36,19 @@ export function createAnimatableComponent<Props> (
3536
iterationStart,
3637
iterationComposite,
3738
autoPlay,
39+
fromClassName,
40+
toClassName,
3841
currentTime,
3942
startTime,
4043
playbackRate,
4144
onStart,
42-
onCancel,
4345
onFinish,
44-
fromClassName,
45-
toClassName,
46+
onCancel,
4647
...rest
4748
} = props
4849
return <animatable-component
4950
ref={ref}
51+
animation={animation}
5052
keyFrames={keyFrames}
5153
keyFramesData={keyFramesData}
5254
options={options}
@@ -63,14 +65,14 @@ export function createAnimatableComponent<Props> (
6365
iterationStart={iterationStart}
6466
iterationComposite={iterationComposite}
6567
autoPlay={autoPlay}
68+
fromClassName={fromClassName}
69+
toClassName={toClassName}
6670
currentTime={currentTime}
6771
startTime={startTime}
6872
playbackRate={playbackRate}
6973
onStart={onStart}
70-
onCancel={onCancel}
7174
onFinish={onFinish}
72-
fromClassName={fromClassName}
73-
toClassName={toClassName}
75+
onCancel={onCancel}
7476
>
7577
<WrappedComponent {...rest} />
7678
</animatable-component>

0 commit comments

Comments
 (0)