plugins.Action.Action.tsx Maven / Gradle / Ivy
The newest version!
import React, { useCallback } from 'react'
import classNames from 'classnames'
import { useDispatch } from '../../core/Redux/useDispatch'
import { Tooltip } from '../../components/snippets/Tooltip/TooltipHOC'
import { LinkBody as SidebarItem } from '../SideBar/Menu/NavItems/Links/LinkBody'
import { LinkBody as HeaderItem } from '../Header/SimpleHeader/Menu/NavItems/Links/LinkBody'
import { Item } from '../CommonMenuTypes'
interface ActionProps {
item: Item,
className: string
isStaticView: boolean
sidebarOpen: boolean
showContent: boolean
isMiniView: boolean
from: 'HEADER' | 'SIDEBAR'
}
export function Action({
item,
className,
sidebarOpen,
isStaticView,
showContent,
isMiniView,
from = 'SIDEBAR',
}: ActionProps) {
const { id, title, action, style } = item
const dispatch = useDispatch()
const onClick = useCallback(() => dispatch(action), [action, dispatch])
const hint = isMiniView ? title : null
return (
{/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */}
{from === 'SIDEBAR'
? (
)
: }
)
}