Skip to content

Commit

Permalink
refactor: switch CollectionVoteButton to JSX
Browse files Browse the repository at this point in the history
  • Loading branch information
fboulnois committed Jan 17, 2024
1 parent b96f469 commit c2d1c3a
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/components/collection_vote_box/CollectionVoteButton.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {useCallback, useEffect, useState} from 'react';
import {button} from 'react-hyperscript-helpers';
import {votingColors} from '../../pages/dar_collection_review/MultiDatasetVotingTab';
import React from 'react';
import { useCallback, useEffect, useState } from 'react';
import { votingColors } from '../../pages/dar_collection_review/MultiDatasetVotingTab';

const styles = {
baseStyle: {
Expand Down Expand Up @@ -41,11 +41,15 @@ export default function CollectionVoteButton(props) {
});
};

return button({
datacy,
style: Object.assign({}, styles.baseStyle, additionalStyle),
onClick: () => !disabled && onClick(),
onMouseEnter: () => !disabled && selectedButtonStyle(),
onMouseLeave: () => !disabled && !isSelected && defaultButtonStyle(),
}, [label]);
return (
<button
data-cy={datacy}
style={{ ...styles.baseStyle, ...additionalStyle }}
onClick={() => !disabled && onClick()}
onMouseEnter={() => !disabled && selectedButtonStyle()}
onMouseLeave={() => !disabled && !isSelected && defaultButtonStyle()}
>
{label}
</button>
);
}

0 comments on commit c2d1c3a

Please sign in to comment.