<?php
/**
 * projects template
 * @package Charming Portfolio
 */
if ( ! defined( 'ABSPATH' ) ) {
    exit; // Exit if accessed directly.
}
$charming_portfolio_projects = $args['works'] ?? false;
if(is_array($charming_portfolio_projects) && !empty($charming_portfolio_projects)):
?>

<div class="charming-portfolio-container charming-portfolio-projects-section">
    <div class="section-header">
        <h2 class="badge">Projects</h2>
        <p class="section-header-note">Some of the noteworthy projects I have built:</p>
    </div>
    <div class="section-content">
        <?php foreach($charming_portfolio_projects as $project): ?>
            <div class="single-project">
                <?php if(isset($project['link']) && !empty($project['link'])): ?>
                    <a href="<?php echo esc_url($project['link']); ?>" target="_blank" class="single-project-link-wrapper" aria-label="<?php echo esc_attr($project['title']); ?>">
                        <span class="dashicons dashicons-external single-project-link"></span>
                    </a>
                <?php endif; ?>
                <?php if(isset($project['thumbnail']) && !empty($project['thumbnail'])): ?>
                    <img src="<?php echo esc_url($project['thumbnail']); ?>" width="300px" height="auto" alt="<?php echo esc_attr($project['title']); ?>" />
                <?php endif; ?>
                <div class="primary-project-details">
                    <h3><?php echo esc_html($project['title']); ?></h3>
                </div>
                <div class="secondary-project-details">
                    <div class="charming-portfolio-has-see-more">
                    <p class="see-more-text"><?php echo wp_kses(CHARMING_PORTFOLIO_special_tag($project['description']), array(
                        'b' => [],
                        'br' => [],
                    )); ?></p>
                    </div>
                    <small><?php echo esc_html($project['tags']); ?></small>
                </div>
            </div>
        <?php endforeach; ?>

    </div>

</div>
<?php endif; ?>
