<?php
/**
 * Mageplaza
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Mageplaza.com license that is
 * available through the world-wide-web at this URL:
 * https://www.mageplaza.com/LICENSE.txt
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade this extension to newer
 * version in the future.
 *
 * @category    Mageplaza
 * @package     Mageplaza_SocialLogin
 * @copyright   Copyright (c) Mageplaza (https://www.mageplaza.com/)
 * @license     https://www.mageplaza.com/LICENSE.txt
 */

$availableSocials = $block->getAvailableSocials();
$childBlock = $block->getChildBlock('request.info');

if ($block->canShow() && sizeof($availableSocials)) :
    ?>
    <div class="block social-login-authentication-channel account-social-login">
        <div class="block-content">
            <?php foreach ($availableSocials as $key => $social) : ?>
                <div class="actions-toolbar social-btn social-btn-actions-toolbar <?= $key ?>-login">
                    <a class="btn btn-block btn-social btn-<?= $block->getBtnKey($key) ?>"
                       data-mage-init='{"socialProvider": {"url": "<?= $social['login_url'] ?>", "label": "<?= __('Login By %1', $social['label']) ?>"}}'>
                        <span class="fa fa-<?= $block->getBtnKey($key) ?>"></span>
                        <?= __('Sign in with %1', $social['label']) ?>
                    </a>
                </div>
            <?php endforeach; ?>
        </div>
    </div>
<?php endif; ?>
<?php if ($childBlock && $childBlock->isRequireMoreInfo()) : ?>
    <div id="social-login-popup" class="white-popup mfp-with-anim mfp-hide"
         data-mage-init='{"Mageplaza_SocialLogin/js/popup":<?= $childBlock->getFormParams() ?>}'>
        <?= $block->getChildHtml('request.info') ?>
    </div>
    <style type="text/css">
        .request-popup{
            overflow-y: unset;
            max-width: 800px;
            left: 30%;
        }
        .request-popup .modal-header{
            padding: 0;
        }
        .request-popup .modal-header button.action-close{
            color: white;
            z-index: 100;
        }
        .request-popup .modal-content{
            padding: 0;
        }
    </style>
<?php endif; ?>
