简体   繁体   中英

How to add hover rule to css className in order to color specific row on hover in react-table?

I have successfully applied classname and added color to specific row in my react-table. But I cannot add hover rule to this className to apply another color when I hover over the row. How to apply hover rule to add hover effect? Thanks in advance!

Here is my code:

<ReactTable>
...

getTrProps={(state, rowInfo, column, instance) => {

        let className = '';
        if(rowInfo && rowInfo.original){
          if(highlightedCerts.includes(rowInfo.original.id)){
            className = ' highlightedCertRow';
          }
          else if(rowInfo.original.isRevoked) {
            className = ' revokedCertRow';
          }
          else if(rowInfo.original.blocked) {
            className = ' blockedCertRow';
          }
        }
     return {
      ...
     className: className,
     ...
     };
/>

Replace green color with its rgb code, if green code is 0,127,252 , then use .highlightedCertRow:hover { background-color: rgba(0,127,252, 0.3) !important; } .highlightedCertRow:hover { background-color: rgba(0,127,252, 0.3) !important; } .

I have solved it on my own. There was a little mistake with nesting tags in css.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM