Skip to content

Commit

Permalink
feat: add basic keyframes() implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Mar 14, 2018
1 parent d47d212 commit cd3dcc7
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion addon/jsx.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ exports.addon = function (renderer) {
}

if (process.env.NODE_ENV !== 'production') {
require('./__dev__/warnOnMissingDependencies')('styled', renderer, ['rule', 'cache']);
require('./__dev__/warnOnMissingDependencies')('jsx', renderer, ['rule', 'cache']);
}

renderer.jsx = function (fn, styles, block) {
Expand Down
22 changes: 22 additions & 0 deletions addon/keyframes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict';

exports.addon = function (renderer) {
if (process.env.NODE_ENV !== 'production') {
require('./__dev__/warnOnMissingDependencies')('keyframes', renderer, ['rule']);
}

renderer.keyframes = function (styles, block) {
if (!block) {
block = renderer.hash(styles);
}
block = renderer.pfx + block;

var obj = {};

obj['@keyframes' + block] = styles;

renderer.put(block, obj);

return block;
};
};
4 changes: 4 additions & 0 deletions addon/rule.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
'use strict';

exports.addon = function (renderer) {
if (process.env.NODE_ENV !== 'production') {
require('./__dev__/warnOnMissingDependencies')('rule', renderer, ['put']);
}

renderer.rule = function (styles, block) {
if (!block) {
block = renderer.hash(styles);
Expand Down

0 comments on commit cd3dcc7

Please sign in to comment.