{#
/**
 * @file
 * Default theme implementation to navigate books.
 *
 * Presented under nodes that are a part of book outlines.
 *
 * Available variables:
 * - tree: The immediate children of the current node rendered as an unordered
 *   list.
 * - current_depth: Depth of the current node within the book outline. Provided
 *   for context.
 * - prev_url: URL to the previous node.
 * - prev_title: Title of the previous node.
 * - parent_url: URL to the parent node.
 * - parent_title: Title of the parent node. Not printed by default. Provided
 *   as an option.
 * - next_url: URL to the next node.
 * - next_title: Title of the next node.
 * - has_links: Flags TRUE whenever the previous, parent or next data has a
 *   value.
 * - book_id: The book ID of the current outline being viewed. Same as the node
 *   ID containing the entire outline. Provided for context.
 * - book_url: The book/node URL of the current outline being viewed. Provided
 *   as an option. Not used by default.
 * - book_title: The book/node title of the current outline being viewed.
 *
 * @see template_preprocess_book_navigation()
 *
 * @ingroup themeable
 */
#}

{# Add the Book library #}
{{ attach_library('socialbase/nav-book') }}

{% if tree or has_links %}
    <nav role="navigation" class="navigation-book" aria-labelledby="book-label-{{ book_id }}">
        {{ tree }}
        {% if has_links %}
            <h2 class="sr-only" id="book-label-{{ book_id }}">{{ 'Book traversal links for'|t }} {{ book_title }}</h2>
            <div class="page-links clearfix">
                {% if prev_url %}
                    <a class="pager__item pager__item--previous btn btn-flat btn-iconized" href="{{ prev_url }}" rel="prev" title="{{ 'Go to previous page'|t }}" role="button">
                      <svg class="icon-inline icon-navigate_before" aria-hidden="true">
                        <title>{% trans %} Previous page {% endtrans %}</title>
                        <use xlink:href="#icon-navigate_before"></use>
                      </svg>
                      <span>{{ prev_title }}</span>
                    </a>
                {% endif %}
                {% if next_url %}
                    <a class="pager__item pager__item--next btn btn-flat btn-iconized" href="{{ next_url }}" rel="next" title="{{ 'Go to next page'|t }}" role="button">
                      <svg class="icon-inline icon-navigate_next" aria-hidden="true">
                        <title>{% trans %} Next page {% endtrans %}</title>
                        <use xlink:href="#icon-navigate_next"></use>
                      </svg>
                      <span>{{ next_title }}</span>
                    </a>
                {% endif %}
            </div>
        {% endif %}
    </nav>
{% endif %}
