feat(left-sidebar-icon-button): wrap with link component

This commit is contained in:
RadoslavDimchev 2024-04-10 16:04:26 +03:00 committed by Radoslav Dimchev
parent 8f112acdb0
commit bf4d8043ce
1 changed files with 24 additions and 25 deletions

View File

@ -1,7 +1,7 @@
import { IconButton } from '@status-im/components'
import { useDispatch } from 'react-redux'
import { Stack } from 'tamagui'
import { useNavigate } from 'react-router'
import { Link } from 'react-router-dom'
import { toggleButtonSelection } from '../../../redux/LeftSidebar/slice'
@ -23,21 +23,19 @@ const LeftSidebarIconButton = ({
path,
}: IconButtonWithDotProps) => {
const dispatch = useDispatch()
const navigate = useNavigate()
const onClickHandler = () => {
isDisabled ? null : dispatch(toggleButtonSelection(id))
navigate(path)
}
return (
<Link to={path} onClick={onClickHandler}>
<Stack style={{ position: 'relative', display: 'inline-block' }}>
<IconButton
icon={iconEl}
variant={isDisabled ? 'outline' : 'ghost'}
selected={isSelected}
disabled={isDisabled}
onPress={onClickHandler}
/>
{isDotOn && (
<Stack
@ -54,6 +52,7 @@ const LeftSidebarIconButton = ({
/>
)}
</Stack>
</Link>
)
}