<?php
/**
 * Displays the menu icon and modal
 *
 * @package United Blog
 */
?>
<div class="menu-modal cover-modal header-footer-group" data-modal-target-string=".menu-modal">
    <div class="menu-modal-inner modal-inner">
        <div class="menu-wrapper">
            <div class="menu-top">
                <button class="toggle close-nav-toggle" data-toggle-target=".menu-modal"
                        data-toggle-body-class="showing-menu-modal" data-set-focus=".menu-modal">
                    <span class="screen-reader-text"><?php echo esc_html__('Close Menu', 'united-blog'); ?></span>
                    <?php united_blog_the_theme_svg('cross'); ?>
                </button><!-- .nav-toggle -->
                <?php
                if (is_active_sidebar('offcanvas-top-menu')) :
                    ?>
                    <div class="united-widget-area offcanvas-widgetarea offcanvas-widgetarea-top regular-widget-area">
                        <?php
                        do_action('united_blog_top_offcanvas_before');
                        dynamic_sidebar('offcanvas-top-menu');
                        do_action('united_blog_top_offcanvas_after');
                        ?>
                    </div>
                <?php endif; ?>
                <?php if (has_nav_menu('primary')) { ?>
                    <nav class="mobile-menu" aria-label="<?php echo esc_attr_x('Mobile', 'menu', 'united-blog'); ?>">
                        <ul class="modal-menu reset-list-style">
                            <?php wp_nav_menu(
                                array(
                                    'container' => '',
                                    'items_wrap' => '%3$s',
                                    'show_toggles' => true,
                                    'theme_location' => 'primary',
                                )
                            ); ?>
                        </ul>
                    </nav>
                <?php } else { ?>
                    <nav class="mobile-menu" aria-label="<?php echo esc_attr_x('Mobile', 'menu', 'united-blog'); ?>">
                        <ul class="modal-menu reset-list-style">
                            <?php wp_list_pages(
                                array(
                                    'match_menu_classes' => true,
                                    'show_toggles' => true,
                                    'title_li' => false,
                                    'walker' => new United_Walker_Page(),
                                )
                            ); ?>
                        </ul>
                    </nav>
                <?php } ?>
                <?php
                if (is_active_sidebar('offcanvas-bottom-menu')) :
                    ?>
                    <div class="united-widget-area offcanvas-widgetarea offcanvas-widgetarea-bottom regular-widget-area">
                        <?php
                        do_action('united_blog_bottom_offcanvas_before');
                        dynamic_sidebar('offcanvas-bottom-menu');
                        do_action('united_blog_bottom_offcanvas_after');
                        ?>
                    </div>
                <?php endif; ?>
            </div><!-- .menu-top -->

            <div class="menu-bottom">
                <?php if (has_nav_menu('social')) { ?>
                    <nav aria-label="<?php esc_attr_e('Expanded Social links', 'united-blog'); ?>">
                        <ul class="social-menu reset-list-style">
                            <?php
                            wp_nav_menu(
                                array(
                                    'theme_location' => 'social',
                                    'container' => '',
                                    'container_class' => '',
                                    'items_wrap' => '%3$s',
                                    'menu_id' => '',
                                    'menu_class' => '',
                                    'depth' => 1,
                                    'link_before' => '<span class="screen-reader-text">',
                                    'link_after' => '</span>',
                                    'fallback_cb' => '',
                                )
                            );
                            ?>
                        </ul>
                    </nav><!-- .social-menu -->
                <?php } ?>
            </div><!-- .menu-bottom -->
        </div><!-- .menu-wrapper -->
    </div><!-- .menu-modal-inner -->
</div><!-- .menu-modal -->
