Add handler on each sidebar button
This commit is contained in:
parent
89ad2ecb73
commit
395f28219d
|
@ -1,5 +1,7 @@
|
|||
import { IconButton } from '@status-im/components'
|
||||
import { useDispatch } from 'react-redux'
|
||||
import { Stack } from 'tamagui'
|
||||
import { toggleButtonSelection } from '../../redux/Sidebars/slice'
|
||||
|
||||
type IconButtonWithDotProps = {
|
||||
iconEl: any
|
||||
|
@ -7,6 +9,7 @@ type IconButtonWithDotProps = {
|
|||
isDotOn: boolean
|
||||
selected?: boolean
|
||||
disabled?: boolean
|
||||
id: string
|
||||
}
|
||||
|
||||
const IconButtonWithDot = ({
|
||||
|
@ -15,10 +18,14 @@ const IconButtonWithDot = ({
|
|||
isDotOn,
|
||||
selected,
|
||||
disabled,
|
||||
id
|
||||
}: IconButtonWithDotProps) => {
|
||||
const dispatch = useDispatch()
|
||||
const onClickHandler = (id) => { if (!disabled) dispatch(toggleButtonSelection(id)) }
|
||||
|
||||
return (
|
||||
<Stack style={{ position: 'relative', display: 'inline-block' }}>
|
||||
<IconButton icon={iconEl} variant={variant} selected={selected} disabled={disabled} />
|
||||
<IconButton icon={iconEl} variant={variant} selected={selected} disabled={disabled} onPress={() => onClickHandler(id)} />
|
||||
{isDotOn && (
|
||||
<Stack
|
||||
style={{
|
||||
|
|
Loading…
Reference in New Issue