All files / components/componentsEvenement/shared BackToEventsButton.tsx

100% Statements 6/6
100% Branches 2/2
100% Functions 2/2
100% Lines 6/6

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    6x                     6x       18x   18x 6x     18x                  
'use client';
 
import { useRouter } from 'next/navigation';
 
interface BackToEventsButtonProps {
  className?: string;
  text?: string;
}
 
/**
 * Composant réutilisable pour le bouton de retour vers la gestion globale des événements
 * Remplace la logique dupliquée dans tous les composants de management
 */
export default function BackToEventsButton({ 
  className = "bg-gray-600 hover:bg-gray-700 text-white px-4 py-2 rounded-md text-sm font-medium transition-colors",
  text = "↩️ gestion globale évènements"
}: BackToEventsButtonProps) {
  const router = useRouter();
 
  const handleBackToEvents = () => {
    router.push('/pagesEvenements');
  };
 
  return (
    <button
      onClick={handleBackToEvents}
      className={className}
    >
      {text}
    </button>
  );
}