<?php
/**
 * Template part for displaying paginated navigation to next/previous set of posts, when applicable
 *
 * @package errigal
 * @since 1.0.0
 */

defined( 'ABSPATH' ) || exit;

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

$html_builder = Html_Builder::create();

the_posts_pagination(
	array(
		'mid_size'  => 0,
		'prev_text' => Icon::get_icon( Icon::PREVIOUS ) .
			$html_builder->create_span(
				array(
					Html_Option::ATTRS => array(
						Html_Attr::CLASS_NAME => Accessibility_Class::SCREEN_READER_TEXT,
					),
				)
			)->get_element(
				esc_html__( 'Newer posts', 'errigal' )
			),
		'next_text' => Icon::get_icon( Icon::NEXT ) .
			$html_builder->create_span(
				array(
					Html_Option::ATTRS => array(
						Html_Attr::CLASS_NAME => Accessibility_Class::SCREEN_READER_TEXT,
					),
				)
			)->get_element(
				esc_html__( 'Older posts', 'errigal' )
			),
	)
);
