import FormCoverPicture from 'src/components/FormInputs/FormCoverPicture';

import useCoverPicture from '../hooks/useCoverPicture';

export type FormLibraryCoverPictureProps = {
  name: string;
};

export const FormLibraryCoverPicture = ({
  name,
}: FormLibraryCoverPictureProps) => {
  const { showCoverPicture, removeCoverPicture, removeCoverPictureModal } =
    useCoverPicture(name);

  if (!showCoverPicture) return null;

  return (
    <>
      {removeCoverPictureModal}
      <FormCoverPicture
        name={name}
        onDelete={removeCoverPicture}
      />
    </>
  );
};

export default FormLibraryCoverPicture;
