<?if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();?>

<?php if (!empty($arResult)): ?>
    <?php
        $moreItems = array_slice($arResult, -3);
    ?>
    <nav class="menu">
        <ul class="menu__list">
            <?php foreach ($arResult as $arItem): ?>
                <li class="menu__item">
                    <a href="<?= $arItem['LINK'] ?>">
                        <?= $arItem['TEXT'] ?>
                    </a>
                </li>
            <?php endforeach; ?>
            <?php if (!empty($moreItems)): ?>
            <li class="menu__more">
                <button>
                    <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
                        <g clip-path="url(#clip0_2553_13206)">
                            <path d="M12.188 10a2.187 2.187 0 1 1-4.375 0 2.187 2.187 0 0 1 4.375 0ZM3.75 7.812a2.187 2.187 0 1 0 0 4.375 2.187 2.187 0 0 0 0-4.374Zm12.5 0a2.187 2.187 0 1 0 0 4.375 2.187 2.187 0 0 0 0-4.374Z" fill="currentColor"></path>
                        </g>
                        <defs>
                            <clipPath id="clip0_2553_13206">
                                <path fill="#fff" d="M0 0h20v20H0z"></path>
                            </clipPath>
                        </defs>
                    </svg>
                </button>
                <ul class="menu__more-list">
                    <?php foreach ($moreItems as $arItem): ?>
                        <li class="menu__item">
                            <a href="<?= $arItem['LINK'] ?>">
                                <?= $arItem['TEXT'] ?>
                            </a>
                        </li>
                    <?php endforeach; ?>
                </ul>
            </li>
            <?php endif; ?>
        </ul>
    </nav>
<?php endif; ?>