import React from 'react';
import { useCookieConsent } from '../../contexts/CookieConsentContext';

const CookiePreferencesLink: React.FC = () => {
  const { hasDecided } = useCookieConsent();

  if (!hasDecided) {
    return null;
  }

  const handleClick = () => {
    
    window.dispatchEvent(new CustomEvent('open-cookie-preferences'));
  };

  return (
    <button
      type="button"
      onClick={handleClick}
      className="text-xs font-medium text-gray-500 underline hover:text-gray-700"
    >
      Cookie preferences
    </button>
  );
};

export default CookiePreferencesLink;

