feat(left-sidebar-icon-button): wrap with link component
This commit is contained in:
parent
8f112acdb0
commit
bf4d8043ce
|
@ -1,7 +1,7 @@
|
||||||
import { IconButton } from '@status-im/components'
|
import { IconButton } from '@status-im/components'
|
||||||
import { useDispatch } from 'react-redux'
|
import { useDispatch } from 'react-redux'
|
||||||
import { Stack } from 'tamagui'
|
import { Stack } from 'tamagui'
|
||||||
import { useNavigate } from 'react-router'
|
import { Link } from 'react-router-dom'
|
||||||
|
|
||||||
import { toggleButtonSelection } from '../../../redux/LeftSidebar/slice'
|
import { toggleButtonSelection } from '../../../redux/LeftSidebar/slice'
|
||||||
|
|
||||||
|
@ -23,37 +23,36 @@ const LeftSidebarIconButton = ({
|
||||||
path,
|
path,
|
||||||
}: IconButtonWithDotProps) => {
|
}: IconButtonWithDotProps) => {
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
const navigate = useNavigate()
|
|
||||||
|
|
||||||
const onClickHandler = () => {
|
const onClickHandler = () => {
|
||||||
isDisabled ? null : dispatch(toggleButtonSelection(id))
|
isDisabled ? null : dispatch(toggleButtonSelection(id))
|
||||||
navigate(path)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack style={{ position: 'relative', display: 'inline-block' }}>
|
<Link to={path} onClick={onClickHandler}>
|
||||||
<IconButton
|
<Stack style={{ position: 'relative', display: 'inline-block' }}>
|
||||||
icon={iconEl}
|
<IconButton
|
||||||
variant={isDisabled ? 'outline' : 'ghost'}
|
icon={iconEl}
|
||||||
selected={isSelected}
|
variant={isDisabled ? 'outline' : 'ghost'}
|
||||||
disabled={isDisabled}
|
selected={isSelected}
|
||||||
onPress={onClickHandler}
|
disabled={isDisabled}
|
||||||
/>
|
|
||||||
{isDotOn && (
|
|
||||||
<Stack
|
|
||||||
style={{
|
|
||||||
position: 'absolute',
|
|
||||||
right: 7,
|
|
||||||
top: 5,
|
|
||||||
width: '9px',
|
|
||||||
height: '9px',
|
|
||||||
borderRadius: '50%',
|
|
||||||
backgroundColor: '#1992D7',
|
|
||||||
border: '1.5px solid #fff',
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
)}
|
{isDotOn && (
|
||||||
</Stack>
|
<Stack
|
||||||
|
style={{
|
||||||
|
position: 'absolute',
|
||||||
|
right: 7,
|
||||||
|
top: 5,
|
||||||
|
width: '9px',
|
||||||
|
height: '9px',
|
||||||
|
borderRadius: '50%',
|
||||||
|
backgroundColor: '#1992D7',
|
||||||
|
border: '1.5px solid #fff',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</Stack>
|
||||||
|
</Link>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue