<?php
/**
 * Shop Toolbar Template Part
 *
 *
 * @package shopbar
 */

defined( 'ABSPATH' ) || exit;

$total = (int) wc_get_loop_prop( 'total', 0 );
?>

<div class="shop-toolbar-bar">
	<div class="toolbar-left">
		<button type="button" class="toolbar-filters-btn" data-open-drawer>
			<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 21v-7"/><path d="M4 10V3"/><path d="M12 21v-9"/><path d="M12 8V3"/><path d="M20 21v-5"/><path d="M20 12V3"/><circle cx="4" cy="12" r="2"/><circle cx="12" cy="10" r="2"/><circle cx="20" cy="14" r="2"/></svg>
			<span><?php esc_html_e( 'Filters', 'shopbar' ); ?></span>
		</button>

		<span class="toolbar-result-count">
			<?php
			if ( $total > 0 ) {
				printf(
					/* translators: %d: number of products. */
					esc_html__( 'Showing %d products', 'shopbar' ),
					$total
				);
			}
			?>
		</span>
	</div>

	<div class="toolbar-right">
		<div class="toolbar-sort">
			<span class="toolbar-sort-label"><?php esc_html_e( 'Sort', 'shopbar' ); ?></span>
			<?php
			if ( function_exists( 'woocommerce_catalog_ordering' ) ) {
				woocommerce_catalog_ordering();
			}
			?>
		</div>

		<div class="toolbar-view" role="group" aria-label="<?php esc_attr_e( 'Product view', 'shopbar' ); ?>">
			<button type="button" class="view-btn active" data-view="grid" aria-label="<?php esc_attr_e( 'Grid view', 'shopbar' ); ?>" aria-pressed="true">
				<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="3" width="7" height="7" rx="1"/><rect x="14" y="3" width="7" height="7" rx="1"/><rect x="3" y="14" width="7" height="7" rx="1"/><rect x="14" y="14" width="7" height="7" rx="1"/></svg>
			</button>
			<button type="button" class="view-btn" data-view="list" aria-label="<?php esc_attr_e( 'List view', 'shopbar' ); ?>" aria-pressed="false">
				<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><circle cx="4" cy="6" r="1"/><circle cx="4" cy="12" r="1"/><circle cx="4" cy="18" r="1"/></svg>
			</button>
		</div>
	</div>
</div>
