<?php
defined( 'ABSPATH' ) || exit;

/**
 * Social Sharing View.
 *
 * @package    Fab
 * @subpackage Fab/View
 */
$exclude = explode( ',', $atts['exclude'] );
$buttons = apply_filters( 'fab_list_of_social_buttons', array(), $atts );
ksort( $buttons );
?>

<div class="fab-container">
    <div class="pt-2 grid grid-cols-2 sm:grid-cols-3 md:grid-cols-5 gap-2">
        <?php foreach ( $buttons as $platform => $button ) : ?>
            <?php if ( in_array( $platform, $exclude, true ) ) : ?>
                <?php continue; ?>
            <?php endif; ?>

            <a 
                href="<?php echo isset( $button['url'] ) ? esc_url( $button['url'] ) : '#'; ?>" 
                class="flex items-center gap-2 px-4 py-2 rounded-sm text-white <?php echo esc_attr( $button['class'] ); ?>"
                <?php if ( isset( $button['target'] ) ) : ?>
                    target="<?php echo esc_attr( $button['target'] ); ?>"
                <?php endif; ?> 
                <?php if ( isset( $button['onclick'] ) ) : ?>
                    onclick="<?php echo esc_attr( $button['onclick'] ); ?>"
                <?php endif; ?>
                style="text-decoration: none;"
            >
                <i class="<?php echo esc_attr( $button['icon'] ); ?>"></i>
                <span class="text-sm font-medium">
                    <?php echo esc_html( $button['label'] ); ?>
                </span>
            </a>
        <?php endforeach; ?>
    </div>
</div>
