<?php
    /**
     * Template part for displaying posts
     *
     * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
     *
     * @package Blog Bee
     * @since 1.0.0
     */
    use BBE\Query_Manager as Query_Manager;
    
    extract( $args );
    $category_count = $cat_value->count;
    ?>
         <div class="story" data-id="<?php echo esc_attr( $cat_value->term_id ); ?>" data-count="<?php echo esc_attr( $category_count ); ?>">

            <div class="preview">

                <?php

                    Query_Manager::get_opening_figure_tag();

                        if( $thumbnail_id ) Query_Manager::get_featured_image( $image_size, [ 'post_id' => $thumbnail_id ] );

                    Query_Manager::get_closing_figure_tag();

                    if( ( $layout === 'two' ) && ( ( $preview_title && $show_preview_title ) || $show_preview_count ) ) echo '<div class="story-title-wrap">';

                        if( $show_preview_count ) echo '<a href="', esc_url( get_category_link( $cat_value->term_id ) ) ,'" class="story-count"><span class="label">', esc_html( $category_count ), '</span><span class="text">', esc_html__( ' Stories', 'blog-bee' ), '</span></a>';

                        if( ( $layout === 'one' ) && $preview_title && $show_preview_title ) echo '<div class="story-title-wrap"><h2 class="story-title"><span class="title-text">', esc_html( $preview_title ) ,'</span></h2></div>';

                        if( ( $layout === 'two' ) && $preview_title && $show_preview_title ) echo '<h2 class="story-title"><span class="title-text">', esc_html( $preview_title ) ,'</span></h2>';

                    if( ( $layout === 'two' ) && ( ( $preview_title && $show_preview_title ) || $show_preview_count ) ) echo '</div>';

                    echo '<div class="indicators">';

                        if( $category_count ) :

                            for( $i = 0; $i < $category_count; $i++ ) :

                                echo '<span class="indicator"></span>';

                            endfor;
                        endif;

                    echo '</div>';

                ?>

            </div>
            
        </div>