Skip to content
Snippets Groups Projects
Unverified Commit 9f2f7183 authored by Douglas Fabris's avatar Douglas Fabris Committed by GitHub
Browse files

chore: `ToolboxAction` pressed state (#29397)

parent d5a58932
No related branches found
No related tags found
No related merge requests found
...@@ -76,7 +76,6 @@ const ToolBox = ({ className }: ToolBoxProps): ReactElement => { ...@@ -76,7 +76,6 @@ const ToolBox = ({ className }: ToolBoxProps): ReactElement => {
// }, [visibleActions.length, open]); // }, [visibleActions.length, open]);
// TODO: Create helper for render Actions // TODO: Create helper for render Actions
// TODO: Add proper Vertical Divider Component
return ( return (
<> <>
...@@ -87,7 +86,7 @@ const ToolBox = ({ className }: ToolBoxProps): ReactElement => { ...@@ -87,7 +86,7 @@ const ToolBox = ({ className }: ToolBoxProps): ReactElement => {
title: t(title), title: t(title),
className, className,
index, index,
info: id === tab?.id, pressed: id === tab?.id,
action, action,
key: id, key: id,
disabled, disabled,
...@@ -106,7 +105,7 @@ const ToolBox = ({ className }: ToolBoxProps): ReactElement => { ...@@ -106,7 +105,7 @@ const ToolBox = ({ className }: ToolBoxProps): ReactElement => {
title: t(title), title: t(title),
className, className,
index, index,
info: id === tab?.id, pressed: id === tab?.id,
action, action,
key: id, key: id,
disabled, disabled,
......
import { IconButton } from '@rocket.chat/fuselage'; import { IconButton } from '@rocket.chat/fuselage';
import type { FC } from 'react';
import { forwardRef } from 'react'; import { forwardRef } from 'react';
const ToolBoxAction: FC<any> = forwardRef(function ToolBoxAction( const ToolBoxAction = forwardRef<HTMLButtonElement, any>(function ToolBoxAction(
{ id, icon, color, action, className, index, title, 'data-tooltip': tooltip, ...props }, { id, icon, action, index, title, 'data-tooltip': tooltip, ...props },
ref, ref,
) { ) {
return ( return (
<IconButton <IconButton
data-qa-id={`ToolBoxAction-${icon}`} data-qa-id={`ToolBoxAction-${icon}`}
className={className} ref={ref}
onClick={() => action(id)} onClick={() => action(id)}
data-toolbox={index} data-toolbox={index}
key={id} key={id}
icon={icon} icon={icon}
position='relative'
tiny tiny
overflow='visible' {...(tooltip ? { 'data-tooltip': tooltip, 'title': '' } : { title })}
ref={ref} {...props}
color={!!color && color}
{...{ ...props, ...(tooltip ? { 'data-tooltip': tooltip, 'title': '' } : { title }) }}
/> />
); );
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment