File tree 2 files changed +38
-6
lines changed
2 files changed +38
-6
lines changed Original file line number Diff line number Diff line change @@ -5,12 +5,15 @@ const {linkTo} = require('@storybook/addon-links');
5
5
const { create} = require ( '../index' ) ;
6
6
const { addon : addonRule } = require ( '../addon/rule' ) ;
7
7
const { addon : addonKeyframes } = require ( '../addon/keyframes' ) ;
8
- const { addon : addonFadeIn } = require ( '../addon/animate/fadeIn' ) ;
8
+
9
+ const animations = [
10
+ 'fadeIn' ,
11
+ 'fadeInDown' ,
12
+ ] ;
9
13
10
14
const nano = create ( ) ;
11
15
addonRule ( nano ) ;
12
16
addonKeyframes ( nano ) ;
13
- addonFadeIn ( nano ) ;
14
17
const { rule} = nano ;
15
18
16
19
var className = rule ( {
@@ -19,7 +22,11 @@ var className = rule({
19
22
background : 'red' ,
20
23
} ) ;
21
24
22
- storiesOf ( 'Addons/Animate' , module )
23
- . add ( 'fadeIn' , ( ) =>
24
- h ( 'div' , { className : 'fadeIn' + className } , 'Hello world' )
25
- )
25
+ let stories = storiesOf ( 'Addons/Animate' , module ) ;
26
+
27
+ animations . forEach ( name => {
28
+ stories = stories . add ( name , ( ) => {
29
+ require ( '../addon/animate/' + name ) . addon ( nano ) ;
30
+ return h ( 'div' , { className : name + className } ) ;
31
+ } ) ;
32
+ } ) ;
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ exports . addon = function ( renderer ) {
4
+ if ( process . env . NODE_ENV !== 'production' ) {
5
+ require ( '../__dev__/warnOnMissingDependencies' ) ( 'animate' , renderer , [ 'keyframes' ] ) ;
6
+ }
7
+
8
+ renderer . put ( '' , {
9
+ '@keyframes fadeInDown' : {
10
+ from : {
11
+ opacity : 0 ,
12
+ transform : 'translate3d(0, -10%, 0)'
13
+ } ,
14
+
15
+ to : {
16
+ opacity : 1 ,
17
+ transform : 'translate3d(0, 0, 0)' ,
18
+ }
19
+ } ,
20
+
21
+ '.fadeInDown' : {
22
+ animation : 'fadeInDown .3s' ,
23
+ }
24
+ } ) ;
25
+ } ;
You can’t perform that action at this time.
0 commit comments