{% extends "page/titled/default.html.twig" %}

{% block css %}
    {{- parent() -}}

    <style>
        #rss-icon {
            color: #fd9f13;
        }
    </style>
{% endblock %}

{% block body %}
    <div class="col-12">
        <div class="body">
            <div class="body-content">
                {{- _page.content.value|murph_url|file_attributes|markdown('post') -}}

                <p>
                    <a target="_blank" title="RSS" href="{{ safe_path(_node.routeName ~ '_rss') }}">
                        <span id="rss-icon" class="deblan-icon deblan-icon-rss"></span>
                        {{- ' Flux RSS' -}}
                    </a>
                </p>
            </div>
        </div>
    </div>

    {% if pager.items is defined %}
        {% for item in pager.items %}
            {% if item.metas|length and item.metas.meta.title %}
                <div class="col-12">
                    <div class="body">
                        {{ {blocks: [{type: 'link', data: item.metas}]}|editorjs_to_html|raw }}
                    </div>
                </div>
            {% else %}
                <div class="col-12">
                    <div class="body">
                        <div class="ejs-link rounded-2xl shadow-md p-2 md:p-8 flex justify-start bg-box">
                            <a href="{{ item.link }}" class="ejs-link--anchor" target="_blank">
                                <div class="ejs-link-content">
                                    <div class="ejs-link-content--title mb-8">{{- item.title -}}</div>

                                    <div class="ejs-link-content--link">
                                        <span class="deblan-icon deblan-icon-link"></span>
                                        {{- item.link -}}
                                    </div>
                                </div>
                            </a>
                        </div>
                    </div>
                </div>
            {% endif %}
        {% endfor %}

        {% if pager.maxPage %}
            <div class="col-12">
                <div class="body">
                    <div class="pager align-right">
                        {{ include('module/_pager.html.twig', {
                            route: _node.routeName,
                            routeParams: {},
                            pages: pager.maxPage,
                            currentPage: pager.page
                        }) }}
                    </div>
                </div>
            </div>
        {% endif %}
    {% else %}
        <div class="grid">
            <div class="col-12 alert alert-notice">
                {{- 'Aucun lien disponible pour le moment.' -}}
            </div>
        </div>
    {% endif %}
{% endblock %}
