import { useRef, useState } from 'react';
import { BREAKPOINTS } from '../../../../../constants';
import { Close } from '../../../../../assets/icons';
import { clsm } from '../../../../../utils';
import { MODAL_TYPE, useModal } from '../../../../../contexts/Modal';
import { useResponsiveDevice } from '../../../../../contexts/ResponsiveDevice';
import Button from '../../../../../components/Button';
import Modal from '../../../../../components/Modal';
import ResponsivePanel from '../../../../../components/ResponsivePanel';
import useResizeObserver from '../../../../../hooks/useResizeObserver';
import ProductButtons from './ProductButtons';
const ProductDescriptionModal = () => {
const { closeModal, content, isModalOpen, type } = useModal();
const { productDescriptionContent } = content || {};
const { isLandscape, currentBreakpoint } = useResponsiveDevice();
const [isContentOverflowing, setIsContentOverflowing] = useState(false);
const mainContentRef = useRef();
const isSmallBreakpoint = currentBreakpoint <= BREAKPOINTS.sm;
useResizeObserver(
mainContentRef,
(entry) => {
if (entry) {
const { scrollHeight, clientHeight } = entry.target;
setIsContentOverflowing(scrollHeight > clientHeight);
}
},
isModalOpen
);
const renderLearnMoreDescription = (children) => (
<>
{
/**
* We mount/unmount the responsive panel to skip the enter and exit
* animations when switching between desktop and mobile views
*/
isSmallBreakpoint && (