<?php
/**
 * Template part for displaying close search button
 *
 * @package errigal
 * @since 1.2.0
 */

defined( 'ABSPATH' ) || exit;

use Errigal\Constant\{
	Errigal_Html_Attr as Html_Attr,
	Errigal_Html_Option as Html_Option,
	Errigal_Shared_Class as Shared_Class,
};
use Errigal\Icon\Errigal_Icon as Icon;
use Errigal\Shared\Errigal_Html_Builder as Html_Builder;

Html_Builder::create()->create_button(
	array(
		Html_Option::ATTRS => array(
			Html_Attr::CLASS_NAME => array(
				Shared_Class::ICON_BUTTON,
				wp_is_mobile()
					? 'mobile-search__close-search-button'
					: 'site-header__close-search-button',
			),
			Html_Attr::TYPE       => Html_Attr::VALUE_BUTTON,
			Html_Attr::ARIA_LABEL => __( 'Close search', 'errigal' ),
		),
	)
)->render_element(
	Icon::get_icon( Icon::TIMES )
);
