<?php
/**
 * Header offcanvas navigation
 *
 * @package wpstream-theme
 */

?>
<div class="offcanvas offcanvas-end d-xl-block " tabindex="-1" id="offcanvas-navbar">
	<div class="offcanvas-header">
		<span class="h5 offcanvas-title"><?php esc_html_e( 'Menu', 'hello-wpstream' ); ?></span>
		<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close">
			<?php echo wpstream_theme_get_svg_icon( 'close.svg' ) ;?>
        </button>
	</div>
	<div class="offcanvas-body wpstream-offcanvas-body">

		<!-- Bootstrap 5 Nav Walker Main Menu -->
		<?php

		$walker = class_exists('WpStream_Bootstrap_5_Wp_Nav_Menu_Walker') ? new WpStream_Bootstrap_5_Wp_Nav_Menu_Walker() : null;

		wp_nav_menu(
			array(
				'theme_location' => 'main-menu',
				'container'      => false,
				'menu_class'     => '',
				'fallback_cb'    => '__return_false',
				'items_wrap'     => '<ul id="wpstream_theme-navbar" class="navbar-nav %2$s">%3$s</ul>',
				'depth'          => 3,
				'walker'         => $walker,
			)
		);
		?>

		<!-- Top Nav 2 Widget -->
		<?php if ( is_active_sidebar( 'top-nav-2' ) ) : ?>
			<?php dynamic_sidebar( 'top-nav-2' ); ?>
		<?php endif; ?>
		<!-- Search Toggler -->
		<?php
		$wpstream_theme_display_search_icon = get_theme_mod( 'wpstream_theme_display_search_icon', true );
		if( $wpstream_theme_display_search_icon ){
			require get_template_directory() . '/template-parts/header-templates/header-search-section.php';
		}

		?>

	</div>
</div>