Fixed checkmarks showing in menu all the time

This commit is contained in:
Martin Berg Alstad 2023-02-23 23:15:20 +01:00
parent 41c64624d9
commit 332a492971

View File

@ -341,11 +341,12 @@ interface SingleMenuItem {
const SingleMenuItem: Component<SingleMenuItem> = ({ option, currentValue, onClick }) => {
const isSelected = () => currentValue()?.value === option.value;
console.log(currentValue()?.value, option.value, isSelected());
return (
<button class={ `hover:underline cursor-pointer last:mb-1 flex-row-center` }
onClick={ onClick }>
<Icon path={ check } aria-label={ isSelected() ? "A checkmark" : "Nothing" }
class={ `text-white ${ !isSelected() && "text-transparent" }` } />
class={ `text-white ${ !isSelected() && "invisible" }` } />
{ option.name }
</button>
);