javivelasco / react-css-themr

Easy theming and composition for CSS Modules.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add CSS example to MyThemedButton in documentation

martinbethann opened this issue · comments

I was hoping you could add the CSS below the first example in the documentation. I need to pass down the icon type via a prop but I'm unable to implement a BEM modifier using the context themr with CSS modules.

{ icon ? <i className={theme.icon}>{icon}</i> : null}

Maybe I'm missing something but how would I go about styling a modified icon, say .twitter? When I try this, {theme.icon} is exposed as .icon.

<Button icon="twitter" />

Thank you so much!

Well, I think that if you are generating that <i className="twitter" />, it's known from upside that twitter will be the class. In that clase you can pass en extra class in the className and, as far as it's defined in the same style.css module, use it as a modifier for the .icon property.

I don't know if I get what you mean but I guess that's it. If you think something is not clear enough in the docs, please feel free to PR and I will merge without a problem :)

@javivelasco Ahh, I got it. It was just my execution. I needed { icon ? <i className={theme[icon]}>{icon}</i> : null} Thank you so much on all the work with this library!

Happy to help!! Thanks 😄