{% extends 'base.html.twig' %}

{% block title %}Article{% endblock %}
{% block stylesheets %}
{{ encore_entry_link_tags('app') }}
<link rel="stylesheet" href={{ asset("styles/articleShow.css") }}>
{% endblock %}

{% block body %}

{% if is_granted('IS_AUTHENTICATED_FULLY') %}
{{ include("dashboard/menu.html.twig") }}

        <div class="d-flex justify-content-around">
            <a href="{{ path('app_article_edit', {'id': article.id}) }}" class="btn btn-success">modifier</a>
            {{ include('article/_delete_form.html.twig') }}
        </div>
{% endif %}
<div id="articleView" style="padding: 15px 0;">
    <div class="article-full">
        <article class="article-card" data-category="arrete-peril">
            <a href={{ path("app_home") }} class="back-btn">← Retour au blog</a>
            <h1>{{article.titre}}</a></h1>
            <div class="article-content">
                <div class="article-meta">
                    <span>📅 {{ article.datePublication ? article.datePublication | date('d/m/Y')  : "Pas de date
                de publication" }} </span>
                    <span>
                        {% if article.tag.snapshot %}
                        {% for tag in article.tag.snapshot %}
                        {{ tag.nom }}
                        {% endfor %}
                        {% endif %}
                    </span>
                </div>
                <p class="article-excerpt">
                    {{article.contenu|nl2br }}
                </p>
                <div class="article-tags">
                    {% if article.tag.snapshot %}
                    {% for a in article.tag.snapshot %}
                    <a href="#" class="tag">{{ a.nom }}</a>
                    {% endfor %}
                    {% endif %}
                </div>
            </div>
        </article>
    </div>
</div>



{% endblock %}