<?php
/**
 * Icon box grid template.
 *
 * @package Rsmspark_Content_Widgets
 */

defined( 'ABSPATH' ) || exit;

if ( empty( $items ) ) {
	return;
}
?>
<section class="rsmspark-cw rsmspark-cw-icon-grid rsmspark-cw-icon-grid--cols-<?php echo esc_attr( $columns ); ?>" style="<?php echo esc_attr( $style_vars ); ?>">
	<?php if ( ! empty( $title ) ) : ?>
		<h2 class="rsmspark-cw-icon-grid__title"><?php echo esc_html( $title ); ?></h2>
	<?php endif; ?>
	<div class="rsmspark-cw-icon-grid__grid">
		<?php foreach ( $items as $item ) : ?>
			<article class="rsmspark-cw-icon-grid__card">
				<?php if ( ! empty( $item['icon'] ) ) : ?>
					<span class="rsmspark-cw-icon-grid__icon <?php echo esc_attr( $item['icon'] ); ?>" aria-hidden="true"></span>
				<?php endif; ?>
				<?php if ( ! empty( $item['title'] ) ) : ?>
					<h3 class="rsmspark-cw-icon-grid__heading"><?php echo esc_html( $item['title'] ); ?></h3>
				<?php endif; ?>
				<?php if ( ! empty( $item['description'] ) ) : ?>
					<p class="rsmspark-cw-icon-grid__text"><?php echo esc_html( $item['description'] ); ?></p>
				<?php endif; ?>
			</article>
		<?php endforeach; ?>
	</div>
</section>
