From 3f83c10037ba0afabb4f20dd64a0344c88b57dfc Mon Sep 17 00:00:00 2001 From: Florian Boulnois Date: Mon, 13 Nov 2023 16:29:17 -0500 Subject: [PATCH] refactor: switch SelectableText to JSX --- src/components/SelectableText.js | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/components/SelectableText.js b/src/components/SelectableText.js index b852158ff6..91e37b3059 100644 --- a/src/components/SelectableText.js +++ b/src/components/SelectableText.js @@ -1,5 +1,5 @@ +import React from 'react'; import { useState, useEffect, useMemo } from 'react'; -import { div } from 'react-hyperscript-helpers'; const defaultUnselectedStyle = { fontSize: '1.8rem', @@ -24,7 +24,6 @@ export default function SelectableText({label, setSelected, selectedType, styleO const {baseStyle, tabSelected, tabUnselected, tabHover} = styleOverride; - const utilizedUnselectedStyle = useMemo(() => { return Object.assign({}, tabUnselected || defaultUnselectedStyle, baseStyle); }, [tabUnselected, baseStyle]); @@ -42,7 +41,6 @@ export default function SelectableText({label, setSelected, selectedType, styleO ); }, [label, selectedType, utilizedSelectedStyle, utilizedUnselectedStyle]); - const addHoverEffect = () => { setStyle(utilizedHoverStyle); }; @@ -50,14 +48,15 @@ export default function SelectableText({label, setSelected, selectedType, styleO setStyle(selectedType === label ? utilizedSelectedStyle : utilizedUnselectedStyle); }; - - return( - div({ - style, - onMouseEnter: addHoverEffect, - onMouseLeave: removeHoverEffect, - onClick: () => !isDisabled && setSelected(label), - className: `tab-selection-${label}` - }, [label]) + return ( +
!isDisabled && setSelected(label)} + className={`tab-selection-${label}`} + > + {label} +
); -} \ No newline at end of file +}