function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
import React, { useEffect, useRef } from 'react';
import LottieWrapper from '../../atom/lottie-wrapper';
import ButtonLink from '../../atom/button-link';
import ReviewCardCongrats from '../../molecule/review-card-congrats';
import style from './style.css';
import propTypes from './prop-types';
export const setScroll = container => () => {
  container.current?.scrollTo && container.current.scrollTo({
    left: 1000,
    behavior: 'smooth'
  });
};
const ReviewCongrats = props => {
  const {
    'aria-label': ariaLabel,
    'data-name': dataName,
    animationLottie,
    title,
    cardCongratsStar,
    cardCongratsRank,
    buttonRevising,
    buttonRevisingSkill
  } = props;
  const container = useRef(null);
  useEffect(() => {
    const timer = setTimeout(setScroll(container), 2000);
    return () => timer && clearTimeout(timer);
  }, []);
  return /*#__PURE__*/React.createElement("div", {
    className: style.mainContainer,
    "aria-label": ariaLabel,
    "data-name": dataName,
    "data-testid": "congrats"
  }, /*#__PURE__*/React.createElement(LottieWrapper
  /** confetti animation */, _extends({}, animationLottie, {
    loop: false,
    animationControl: 'play',
    autoplay: true,
    "data-name": "lottie-wrapper",
    className: style.lottie,
    backupImageClassName: style.ie11Backup
  })), /*#__PURE__*/React.createElement("div", {
    className: style.containerCongrats
  }, /*#__PURE__*/React.createElement("div", {
    className: style.title
  }, title), /*#__PURE__*/React.createElement("div", {
    ref: container,
    className: style.containerCards
  }, cardCongratsRank ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ReviewCardCongrats, _extends({}, cardCongratsStar, {
    className: style.cardStar
  })), /*#__PURE__*/React.createElement(ReviewCardCongrats, _extends({}, cardCongratsRank, {
    timerAnimation: 1800,
    className: style.cardRank
  }))) : /*#__PURE__*/React.createElement(ReviewCardCongrats, _extends({}, cardCongratsStar, {
    className: style.cardStarNoRank
  }))), /*#__PURE__*/React.createElement("div", {
    className: style.buttonContainer
  }, buttonRevising ? /*#__PURE__*/React.createElement(ButtonLink, _extends({}, buttonRevising, {
    className: style.buttonRevise,
    "data-testid": "revise-skill-link"
  })) : null, buttonRevisingSkill ? /*#__PURE__*/React.createElement(ButtonLink, _extends({}, buttonRevisingSkill, {
    className: style.buttonRevise,
    "data-testid": "revise-another-skill-link"
  })) : null)));
};
ReviewCongrats.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
export default ReviewCongrats;
//# sourceMappingURL=index.js.map