diegohaz/styled-tools

Add default case option to switchProp

nderscore opened this issue ยท 4 comments

I think it might be nice to have a default case option for the switchProp() function. Having a generic else case without having to specifically write out every other possible prop value would be nice. Plus, it makes it closer to mirroring the functionality of an actual switch statement! ๐Ÿ˜‰

I think adding a third optional argument (identical to how prop() 's defaultCase argument works) would be fine, as it wouldn't break backwards compatibility with current usage of the function.

Released as v0.2.3

Thanks!

@diegohaz can this be added to readme examples?

@mehrad77 Yes! Would you mind sending a PR updating https://github.com/diegohaz/styled-tools/blob/master/src/switchProp.js and running npm run docs