<?php
    /**
     * Template part for web stories
     * 
     * @since 1.0.0
     */
    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

                    echo '<figure class="preview-thumb">';

                        if( $thumbnail_id ) echo wp_kses_post( get_the_post_thumbnail( $thumbnail_id, $image_size, [ 'loading'   => 'lazy' ] ) );

                    echo '</figure>';

                    echo '<a href="', esc_url( get_category_link( $cat_value->term_id ) ) ,'" class="item"><span class="label">', esc_html( $cat_value->name ), '</span></a>';

                    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-postx' ), '</span></a>';

                    if( $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>';

                    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>