diff --git a/platform/firecamp-platform/src/components/containers/SidebarContainer.tsx b/platform/firecamp-platform/src/components/containers/SidebarContainer.tsx index 889b6768..3e1bedef 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..66cf053a 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..d3d27357 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[]; +} diff --git a/platform/firecamp-ui/src/components/tooltip/Tooltip.tsx b/platform/firecamp-ui/src/components/tooltip/Tooltip.tsx new file mode 100644 index 00000000..f3c65b0a --- /dev/null +++ b/platform/firecamp-ui/src/components/tooltip/Tooltip.tsx @@ -0,0 +1,36 @@ +import { FC } from 'react'; + +import { MantineColor, Tooltip as MantineTooltip } from '@mantine/core'; +import { ArrowPosition, FloatingPosition } from '@mantine/core/lib/Floating'; + +interface ITooltip { + arrowOffset?: number; + arrowPosition?: ArrowPosition; + arrowRadius?: number; + arrowSize?: number; + children: React.ReactNode; + closeDelay?: number; + color?: MantineColor; + disabled?: boolean; + events?: { + hover: boolean; + focus: boolean; + touch: boolean; + }; + label: React.ReactNode; + multiline?: boolean; + offset?: number; + openDelay?: number; + position?: FloatingPosition; + withArrow?: boolean; +} + +const Tooltip: FC = ({ label, children, ...props }) => { + return ( + + {children} + + ); +}; + +export default Tooltip;