<?php 
if (isset($block['data']['preview_image_help'])) {    /* rendering in inserter preview  */
    echo '<img src="' . $block['data']['preview_image_help'] . '" style="width:100%; height:auto;">';
} else {

 $data = array(
    'top_title'       => get_field('ftm_comp_tool_title'),
    'top_text'        => get_field('ftm_comp_top_text'),
    'bottom_text'     => get_field('ftm_comp_bottom_text'),
    'block_name'     => 'ftm-comparison-tool'
);

?>
<link href="https://cdn.jsdelivr.net/npm/swiper@9/swiper-bundle.min.css" rel="stylesheet"/>
<div class="ftmct-wrapper">
    <div class="__header">
        <div class="__title">
            <h2></h2>
            <p></p>
        </div>
        <div class="__action-holder">
            <button id="ftmct-compare-btn" name="ftmct-compare-btn" class="__action_button" onclick="ftm_sites_compare();" ><i class="__compare_icon"></i>Compare Dating Sites</button>
        </div>
    </div>
    <div class="__search-wrapper">
        <input id="ftmct-search-value" name="ftmct-search-value" class="__search_textbox" placeholder="Search your Dating Site" />
        <button id="ftmct-search-btn" name="ftmct-search-btn" class="__search_button" onclick="ftm_sites_search('ftmct-search-value');" >Search</button>
    </div>
    <div id="ftm_sites_list_container" class="__sites-list">
    </div>
    <div class="__sites-bottom-divider"></div>
    <div class="__sites-bottom-disclaimer"></div>
    <div class="ftmct_loading"></div>
</div>
<input type="hidden" id="ftmct_top_title_value"   value="<?php echo $data['top_title']; ?>" />
<input type="hidden" id="ftmct_top_text_value"    value="<?php echo $data['top_text']; ?>" />
<input type="hidden" id="ftmct_bottom_text_value" value="<?php echo $data['bottom_text']; ?>" />

<script>    
    let ftm_ajax_url = '<?php echo admin_url( 'admin-ajax.php' ); ?>';
</script>
<script src="https://cdn.jsdelivr.net/npm/swiper@9/swiper-bundle.min.js"></script>
<script src="<?php echo FTMBLOCKS_PLUGIN_URL . "blocks/" . $data['block_name']. "/assets/js/". $data['block_name'] .".js"; ?>" ></script>
<?php } ?>