Like title says I want to know if I can use hover in Style component? If so can you tell me how I can do that.
Hi alphiii,
There's an example in the readme, see https://github.com/FormidableLabs/radium.
I did run into one situation when working with radium, where the :hover was applied to all children as well. As a workaround, you can create another element with the scopeselecter = "component:hover". Hope that helps.
Here's an example of the workaround that I used (the two Style components):
render(){
return (
<div className="panel">
<h1>{this.props.panel.title}</h1>
<img src={this.props.panel.imgSrc} />
<ul>
{this.props.panel.listItems.map((listItem, i) => <li key={i}>{listItem}</li>)}
</ul>
<p>{this.props.panel.textContents}</p>
<Style
scopeSelector=".panel"
rules={{
'display': 'block',
'max-width': '500px',
'padding': '0px auto',
'background-color': 'rgba(225, 190, 231, 1)',
'border': '1px solid #7B1FA2',
'border-radius': '15px',
}}
/>
<Style
scopeSelector=".panel:hover"
rules={{
"transform": "scale(1.1)"
}}
/>
</div>
)
Thank you this works, but what about if you want to use media queries also inside Style component?
Hi @alphiii, the docs on the Style component have a media query example: https://github.com/FormidableLabs/radium/tree/master/docs/api#style-component
Hope that helps!
Most helpful comment
Here's an example of the workaround that I used (the two Style components):
render(){