<?php
/**
 * The sidebar containing the main widget area
 *
 * @link    https://developer.wordpress.org/themes/basics/template-files/#template-partials
 *
 * @package wpstream-theme
 */

if ( ! is_active_sidebar( 'sidebar-1' ) ) {
	return;
}

$sidebarID = apply_filters( 'wpstream_sidebar_id_by_post_type', 'sidebar-1' );

?>

<div class="col-lg-3 order-first order-lg-last sidebar-column">

	<aside id="secondary" class="widget-area">

		<button class="btn btn-outline-primary w-100 mb-4 d-flex d-lg-none justify-content-between align-items-center" type="button" data-bs-toggle="offcanvas" data-bs-target="#sidebar" aria-controls="sidebar">
			<?php esc_html_e( 'Open side menu', 'hello-wpstream' ); ?> <i class="fa-solid fa-ellipsis-vertical"></i>
		</button>

		<div class="offcanvas-lg offcanvas-end" tabindex="-1" id="sidebar" aria-labelledby="sidebarLabel">

			<div class="offcanvas-header">
				<span class="h5 offcanvas-title" id="sidebarLabel"><?php esc_html_e( 'Sidebar', 'hello-wpstream' ); ?></span>
				<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#sidebar" aria-label="Close">
					<?php echo wpstream_theme_get_svg_icon( 'close.svg' ) ;?>
                </button>
			</div>

			<div class="offcanvas-body flex-column">
				<?php dynamic_sidebar( $sidebarID ); ?>
			</div>
		</div>

		<!-- #secondary -->
	</aside>
</div>