From cc3e75eea086de6c16c7cd36625a24d8bc0b55cf Mon Sep 17 00:00:00 2001 From: Vadim Dalecky Date: Sat, 17 Mar 2018 23:33:32 +0000 Subject: [PATCH] feat: add fadeInExpand animation --- .storybook/animate.stories.js | 1 + addon/animate/fadeInExpand.js | 25 +++++++++++++++++++++++++ docs/animations.md | 1 + 3 files changed, 27 insertions(+) create mode 100644 addon/animate/fadeInExpand.js diff --git a/.storybook/animate.stories.js b/.storybook/animate.stories.js index 90f0383e..99ed103f 100644 --- a/.storybook/animate.stories.js +++ b/.storybook/animate.stories.js @@ -9,6 +9,7 @@ const {addon: addonKeyframes} = require('../addon/keyframes'); const animations = [ 'fadeIn', 'fadeInDown', + 'fadeInExpand', ]; const nano = create(); diff --git a/addon/animate/fadeInExpand.js b/addon/animate/fadeInExpand.js new file mode 100644 index 00000000..993d65f0 --- /dev/null +++ b/addon/animate/fadeInExpand.js @@ -0,0 +1,25 @@ +'use strict'; + +exports.addon = function (renderer) { + if (process.env.NODE_ENV !== 'production') { + require('../__dev__/warnOnMissingDependencies')('animate', renderer, ['keyframes']); + } + + renderer.put('', { + '@keyframes fadeInExpand': { + from: { + opacity: 0, + transform: 'scale(.95)' + }, + + to: { + opacity: 1, + transform: 'scale(1)', + } + }, + + '.fadeInExpand': { + animation: 'fadeInExpand .3s', + } + }); +}; diff --git a/docs/animations.md b/docs/animations.md index 466b89e6..1b06621b 100644 --- a/docs/animations.md +++ b/docs/animations.md @@ -6,6 +6,7 @@ name. - `animate/fadeIn` - `animate/fadeInDown` +- `animate/fadeInExpand` Read more about the [Addons Installation](./Addons.md#addon-installation).