ctrlplusb / react-component-queries

Provide props to your React Components based on their Width and/or Height.
MIT License
182 stars 12 forks source link

Accept "sizePassthrough" prop #81

Open bradennapier opened 7 years ago

bradennapier commented 7 years ago

Ok - first pull request here so sorry if I did not follow any special rules to it :-).

Anyway, this just allows defining sizePassthrough with a boolean or a string. boolean will pass { size: { height, width } whereas string will pass { [this.props.sizePassthrough]: { height, width } }

You may have a better way you would want to handle this (if accepted) with the merge components. I simply name the sizePassthrough the string that it should add to the props and if the value is defined it sends it through.

bradennapier commented 7 years ago

Added updates to eslint configuration because it was failing for me with the given version. Fixed the eslint errors that it gave me throughout. All looks good now.

codecov[bot] commented 7 years ago

Codecov Report

Merging #81 into master will decrease coverage by 2.79%. The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master      #81     +/-   ##
=========================================
- Coverage   98.38%   95.58%   -2.8%     
=========================================
  Files           5        5             
  Lines          62       68      +6     
  Branches       16       18      +2     
=========================================
+ Hits           61       65      +4     
- Misses          0        2      +2     
  Partials        1        1
Impacted Files Coverage Δ
src/componentQueries.js 95.83% <66.66%> (-4.17%) :arrow_down:

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 5279a50...23710ce. Read the comment docs.