<?php

function renderCloseBlockElement($b, $element, $custom_classes, $elStyles, $colors, $viewport) {
  $data = $element['data'];
  $user_data = $data['user_data'];
  $elMarkup = "";

  extract($user_data);

  $fontData = getFontData($user_data, "textFont");
  $alignMap = array(
    "left" => "flex-start",
    "center" => "center",
    "right" => "flex-end"
  );
  $alignment = useVar($user_data,"alignment", "center");
  $iconEl = '<i class="flo-flex-icon-menu-mobile-popup-close"></i>';
  $textEl = '
    <div
      class="flex-element-type-close-block__text"
      data-font="'.$fontData['dataFont'].'"
      style="'.$fontData['style'].'"
    >
      '.$textClose.'
    </div>'
  ;
  $toggle = $type === "icon" ? $iconEl : $textEl;

  $elMarkup .= '<div class="'.$b.'__element '.$b.'__element--'.$element["id"].' '.$b.'__element--close-block '.$custom_classes.'" style="'.$elStyles.'">
    <div
      class="flex-element-type-close-block"
      style="
        --color: '.getStyleKitColor($color).';
        --color-hover:'.getStyleKitColor($colorHover).';
        --icon-size: '.remCalc($iconSize).';
        justify-content: '.$alignMap[$alignment].';
      "
      data-animation="'.$animation.'"
    >
      '.$toggle.
    '</div>
  </div>';

  return $elMarkup;
}
