diff --git a/platform/firecamp-platform/src/components/containers/SidebarContainer.tsx b/platform/firecamp-platform/src/components/containers/SidebarContainer.tsx index 889b6768..5319c248 100644 --- a/platform/firecamp-platform/src/components/containers/SidebarContainer.tsx +++ b/platform/firecamp-platform/src/components/containers/SidebarContainer.tsx @@ -38,8 +38,8 @@ const compositeBarItems = [ tabIndex={-1} /> ), - // text: `Collections (${scPrefix} ⇧ C)`, item: EActivityBarItems.Explorer, + toolTip: `Collections (${scPrefix} ⇧ C)`, }, { id: EActivityBarItems.Environment, @@ -52,8 +52,8 @@ const compositeBarItems = [ tabIndex={-1} /> ), - // text: `Environment (${scPrefix} ⇧ E)`, item: EActivityBarItems.Environment, + toolTip: `Environment (${scPrefix} ⇧ E)`, }, { id: EActivityBarItems.History, @@ -66,8 +66,8 @@ const compositeBarItems = [ tabIndex={-1} /> ), - // text: `History (${scPrefix} ⇧ H)`, item: EActivityBarItems.History, + toolTip: `History (${scPrefix} ⇧ H)`, }, ]; @@ -106,8 +106,8 @@ const actionBarItems = [ tabIndex={-1} /> ), - text: `User (${scPrefix} ⇧ U)`, item: EActivityBarItems.User, + toolTip: `User (${scPrefix} ⇧ U)`, }, { id: EActivityBarItems.Settings, @@ -118,8 +118,8 @@ const actionBarItems = [ tabIndex={-1} /> ), - text: `Settings (${scPrefix} ⇧ /)`, item: EActivityBarItems.Settings, + toolTip: `Settings (${scPrefix} ⇧ /)`, }, ]; diff --git a/platform/firecamp-ui/src/components/activity-bar/ActionItem.tsx b/platform/firecamp-ui/src/components/activity-bar/ActionItem.tsx index e480c9c9..d5f292e5 100644 --- a/platform/firecamp-ui/src/components/activity-bar/ActionItem.tsx +++ b/platform/firecamp-ui/src/components/activity-bar/ActionItem.tsx @@ -1,7 +1,7 @@ -import { FC } from 'react'; +import { FC, forwardRef } from 'react'; import cx from 'classnames'; import { UserCircle2 } from 'lucide-react'; -// import ReactTooltip from 'react-tooltip'; +import ToolTip from '../tooltip/ToolTip'; const ActionItem: FC = ({ id = '', @@ -10,48 +10,70 @@ const ActionItem: FC = ({ active = false, onClick = () => {}, icon = '', - tooltip = '', + tooltip, }) => { + const Item = forwardRef( + ( + { + active = false, + className = '', + style = {}, + onClick = () => {}, + icon = '', + }, + ref + ) => ( +
+ {!!icon ? icon : } +
+ ) + ); - return ( -
- {!!icon ? ( - icon - ) : ( - - )} - {/* @ts-ignore - */} -
+ onClick={onClick} + style={style} + icon={icon} + /> + + ) : ( + ); }; @@ -89,7 +111,7 @@ export interface IActionItem { /** * Add a tooltip */ - tooltip: string; + tooltip?: string; onClick: () => void; } diff --git a/platform/firecamp-ui/src/components/activity-bar/ActionItems.tsx b/platform/firecamp-ui/src/components/activity-bar/ActionItems.tsx index 4ff315cc..a91946ac 100644 --- a/platform/firecamp-ui/src/components/activity-bar/ActionItems.tsx +++ b/platform/firecamp-ui/src/components/activity-bar/ActionItems.tsx @@ -4,52 +4,48 @@ import ActionItem from './ActionItem'; const ActionItems: FC = ({ items = [], activeItem = '', - onClickItem = () => { } + onClickItem = () => {}, }) => { return ( - {items.map((item: any, i: number) => - ( + {items.map((item: any, i: number) => ( { - onClickItem(item) + onClickItem(item); }} /> - ) - )} + ))} ); }; -export default ActionItems - +export default ActionItems; ActionItems.defaultProps = { id: '', className: '', - items: [] + items: [], }; export interface IActionItems { + activeItem?: string; - activeItem?: string, - - onClickItem: (action: any) => void, + onClickItem: (action: any) => void; /** * Is this the principal call to action on the page? */ - id?: string, + id?: string; /** * Add class name to show custom styling */ - className?: string, + className?: string; /** * to show list of action items */ - items?: any[] -} \ No newline at end of file + items?: any[]; +}