Last active
April 9, 2016 17:47
-
-
Save sairion/b2513f67bdf233d5e5f1188cc03f608a to your computer and use it in GitHub Desktop.
style-mixin.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const Display = { | |
None: { display: 'none' }, | |
Block: { display: 'block' }, | |
Inline: { display: 'inline' }, | |
InlineBlock: { display: 'inline-block' }, | |
NoneIf(cond) { | |
return cond ? Display.None : null; | |
}, | |
BlockIf(cond) { | |
return cond ? Display.Block : null; | |
}, | |
InlineIf(cond) { | |
return cond ? Display.Inline : null; | |
}, | |
InlineBlockIf(cond) { | |
return cond ? Display.InlineBlock : null; | |
} | |
}; | |
// <div style={Display.InlineIf(conditionMet)}> ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment