CAAPIM / themer

Framework agnostic utility to make generic JavaScript components themeable and extensible.
MIT License
1 stars 1 forks source link

feat: add variant support #13

Closed truemagic-coder closed 7 years ago

truemagic-coder commented 7 years ago

Status

READY

Description

Variants is a framework agonistic methodology to add classes to an existing theme for a component (root theme node). This is accomplished by toggling of boolean values of the variant via props with the classnames being in the theme object.

In order to accomplish this switching I added 3 methods - theme.getVariants, variantApply, and themer.getVariants.

theme.getVariants - pulls the variants from the the passed in theme. themer.getVariants - references theme.getVariants to make variants accessible to outside packages - like react-themer variantApply - loops through all variants and checks if the prop with the same key is true then add the classname to the root node of the theme.

codecov-io commented 7 years ago

Codecov Report

Merging #13 into master will increase coverage by 0.34%.

@@            Coverage Diff             @@
##           master      #13      +/-   ##
==========================================
+ Coverage   96.87%   97.22%   +0.34%     
==========================================
  Files           5        5              
  Lines          96      108      +12     
  Branches       23       24       +1     
==========================================
+ Hits           93      105      +12     
  Misses          3        3
Impacted Files Coverage Δ
src/middleware/index.js 100% <ø> (ø) :white_check_mark:
src/utils/index.js 90.9% <100%> (+4.24%) :white_check_mark:
src/Themer.js 100% <100%> (ø) :white_check_mark:
src/theme/index.js 97.61% <100%> (+0.05%) :white_check_mark:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update eac3194...9602cb9. Read the comment docs.