All files / src/components useAboutModal.hook.ts

100% Statements 18/18
100% Branches 3/3
100% Functions 1/1
100% Lines 18/18

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 361x   1x                           1x 1x 11x   11x 2x 11x   11x 2x 11x   11x 11x 11x 11x 11x 11x 11x  
import { useCallback, useState } from 'react';
 
/**
 * Hook to manage About modal visibility state.
 * Extracted from SpeedDialMenu.tsx for better code organization.
 *
 * @returns About modal state and handlers
 *
 * @example
 * ```tsx
 * const { aboutOpen, handleAboutOpen, handleAboutClose } = useAboutModal();
 *
 * <Button onClick={handleAboutOpen}>About</Button>
 * <AboutModal aboutOpen={aboutOpen} setAboutOpen={handleAboutClose} />
 * ```
 * @source
 */
export function useAboutModal() {
  const [aboutOpen, setAboutOpen] = useState(false);
 
  const handleAboutOpen = useCallback(() => {
    setAboutOpen(true);
  }, []);
 
  const handleAboutClose = useCallback((open: boolean) => {
    setAboutOpen(open);
  }, []);
 
  return {
    aboutOpen,
    handleAboutOpen,
    handleAboutClose,
    setAboutOpen,
  };
}