All files / src/components/features/support/ChatbotWidget ChatbotButton.tsx

40% Statements 16/40
100% Branches 0/0
0% Functions 0/1
40% Lines 16/40

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 411x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x                                                  
'use client';
 
/**
 * ChatbotButton - Floating action button for opening the chatbot
 */
 
import React from 'react';
import { Icon } from '@/components/ui/icons';
 
export interface ChatbotButtonProps {
  /** Whether the chatbot window is open */
  isOpen: boolean;
  /** Click handler */
  onClick: () => void;
}
 
export default function ChatbotButton({ isOpen, onClick }: ChatbotButtonProps) {
  return (
    <button
      type="button"
      onClick={onClick}
      className={`
        flex items-center justify-center
        w-14 h-14 rounded-full
        bg-blue-600 hover:bg-blue-700
        text-white shadow-lg
        transition-all duration-200
        focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2
        ${isOpen ? 'scale-90' : 'scale-100 hover:scale-105'}
      `}
      aria-label={isOpen ? 'Close chat' : 'Open chat'}
    >
      {isOpen ? (
        <Icon name="close" size={24} />
      ) : (
        <Icon name="chat-dots" size={24} />
      )}
    </button>
  );
}