Code Monkey home page Code Monkey logo

Comments (3)

vinceroti avatar vinceroti commented on June 7, 2024 5

If anyone comes across this and still is having trouble with hover, you have to add this.props to the end of your styles. I'll post my code as an example.

import reactCSS, { hover } from 'reactcss';
import React, { Component } from 'react';
import { Glyphicon } from 'react-bootstrap';




class Portfolio extends Component {

  render() {
    const styles = reactCSS({
      'default': {
        portfolio: {
          backgroundColor: 'gray',
          color: 'white',
          margin: 'auto',
          textAlign: 'center',
          paddingTop: '50px'
        },

        line: {
          padding: '0',
          border: 'none',
          borderTop: 'solid 5px',
          textAlign: 'center',
          width: '100px',
          maxWidth: '20%',
          margin: 'auto',
          backgroundColor: '#18BC9C',
          color: 'white',
          display: 'inline-block',
          borderRadius: '250px',

        },

        star: {
          display: 'inline-block',
          position: 'relative',
          top: '11px',
          fontSize: '2em',
          padding: '0 0.25em',
          borderColor: 'white',
        },

        title: {
          fontWeight: 'bold',
          fontSize: '40px',
          letterSpacing: '2.5px'
        },

        ul: {
          paddingLeft: '0',
          listStyleType: 'none'
        },
        image: {
          display: 'inline-block',
          margin: 'auto',
          marginTop: '20px',
          width: '250px',
          maxWidth: '90%',
        },
      },
      'hover': {
        image: {
          backgroundColor: "red"
        }
      }
    }, this.props)

    return (
      <div style={styles.portfolio} id="portfolio">
        <h2 style={styles.title}> PORTFOLIO </h2>
        <hr style={styles.line}/>
          <Glyphicon glyph="star" style={styles.star} />
        <hr style={styles.line} />
        <div>
          <ul style={styles.ul}>

              <li style={styles.image}><img style={styles.image} src="wiki.png" alt="Wikipedia Logo" /></li>

              <li style={styles.image}><img style={styles.image}  src="google.png" alt="Google Logo" /></li>
            </ul>
        </div>
      </div>
    );
  }
}



export default hover(Portfolio)

from reactcss.

faroe228 avatar faroe228 commented on June 7, 2024 3

It's not working for me and I'm using React.version 15.1.0
I noticed it's using a boolean hover property. My first workaround was to just dynamically assign the default css based on the hover property value ( looks like hover key is ignored ).

Update: did some searching found out you have to add something like this to your reactcss
, {
'hover': (props.hover === true)
}

from reactcss.

rkumar-cognam avatar rkumar-cognam commented on June 7, 2024

not working for me too. Where exactly you put
{
'hover': (props.hover === true)
}
can you please paste your code

from reactcss.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.