import { Badge, Box, Button } from '@rocket.chat/fuselage'; import type { ComponentProps } from 'react'; import { useTranslation } from 'react-i18next'; export type ActionToggleChatProps = { pressed: boolean; onClick: () => void; badgeCount?: number; badgeVariant?: ComponentProps['variant']; }; const ActionToggleChat = ({ pressed, onClick, badgeCount = 0, badgeVariant = 'secondary' }: ActionToggleChatProps) => { const { t } = useTranslation(); const icon = pressed ? 'chevron-down' : 'chevron-up'; const label = pressed ? t('Hide_chat') : t('Show_chat'); // The badge is decorative to assistive tech: the count travels in the button's own name instead, so it is // announced once, with the control it belongs to, rather than as a stray number beside it. return ( {badgeCount > 0 && ( {badgeCount} )} ); }; export default ActionToggleChat;