Skip to content

Commit

Permalink
improve code style
Browse files Browse the repository at this point in the history
  • Loading branch information
gigitux committed Nov 6, 2024
1 parent ed48f39 commit c9e418b
Showing 1 changed file with 8 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,14 @@ export const useClickableItemProps = < Item >(
[ className + '--clickable' ]: isClickable,
} ),
role: isClickable ? 'button' : undefined,
onClick: () => {
if ( isClickable ) {
onClickItem( item );
}
},
tabIndex: isClickable ? 0 : undefined,
onKeyDown: ( event: React.KeyboardEvent ) => {
if (
( event.key === 'Enter' || event.key === '' ) &&
isClickable
) {
onClickItem( item );
}
},
onClick: ! isClickable ? undefined : () => onClickItem( item ),
onKeyDown: ! isClickable
? undefined
: ( event: React.KeyboardEvent ) => {
if ( event.key === 'Enter' || event.key === '' ) {
onClickItem( item );
}
},
};
};

0 comments on commit c9e418b

Please sign in to comment.