Decisiv / styled-components-modifiers

A library to enable BEM flavored modifiers (and responsive modifiers) in styled components.
MIT License
298 stars 11 forks source link

feat(enhance modifiers): adds responsive functionality to modifiers utils #23

Closed andrewtpoe closed 5 years ago

andrewtpoe commented 5 years ago

fixes #21

OVERVIEW

This PR enhances the applyStyleModifiers and styleModifierPropTypes utilities to enable responsive behavior that was previously only enabled in applyResponsiveStyleModifiers and responsiveStyleModifierPropTypes.

With this PR, any modifiers prop will be able to accept one of three types of values:

If the object pattern is used, the value selected will be based on the value of a size prop that the developer must supply. If size is not provided or does not match a key in the object, modifiers['_'] will be selected and applied as the defaults. If no '_' key is available, no modifiers will be applied.

WHERE SHOULD THE REVIEWER START?

View the README

HOW CAN THIS BE MANUALLY TESTED?

Run the test suite. Coverage is at 100% across all metrics.

ANY NEW DEPENDENCIES ADDED?

no

CHECKLIST

Be sure all items arebefore submitting a PR for review.

GIF

Share a fun GIF to say thanks to your reviewer: https://giphy.com