import { useState } from 'react';

function useEditableComponent(isEditable = false) {
  const [isShowedEditable, setIsShowedEditable] = useState(false);

  const handleShowEditable = () => {
    if (isEditable && !isShowedEditable) {
      setIsShowedEditable(true);
    }
  };
  const handleHideEditable = () => setIsShowedEditable(false);

  return { isShowedEditable, handleShowEditable, handleHideEditable };
}

export default useEditableComponent;
