{% set NewsList = repository('Eccube\\Entity\\News').getList() %}
<div class="ec-role">
<div class="ec-newsRole">
<h2 class="top_title">お知らせ</h2>
<ul class="list-unstyled mb-0">
{% for News in NewsList|slice(0, 3) %}
<li class="py-3 border-bottom">
<div class="d-flex align-items-center gap-3 mb-2">
<time class="text-secondary small">{{ News.publish_date|date("Y/m/d") }}</time>
{% if News.isUrgent %}
<span class="d-inline-flex align-items-center gap-1 small fw-semibold">
<span class="badge bg-danger fs-6">
<i class="fa fa-exclamation-triangle me-1" aria-hidden="true"></i>緊急
</span>
</span>
{% elseif News.isImportant %}
<span class="d-inline-flex align-items-center gap-1 small fw-semibold">
<span class="badge bg-warning fs-6">
<i class="fa fa-bullhorn me-1" aria-hidden="true"></i>重要
</span>
</span>
{% endif %}
</div>
<div>
{% if News.url %}
<a href="{{ News.url }}" class="text-dark text-decoration-none link-hover" {% if News.link_method == '1' %}target="_blank" rel="noopener"{% endif %}>
{{ News.title }}
</a>
{% else %}
<a href="{{ url('news_detail', {'id': News.id}) }}" class="text-dark text-decoration-none link-hover">
{{ News.title }}
</a>
{% endif %}
</div>
</li>
{% endfor %}
</ul>
{% if NewsList|length > 3 %}
<div class="text-end mt-3">
<a class="btn-metro-color px-5 py-2 fs-6" href="{{ url('news_index') }}" role="button">一覧を見る</a>
</div>
{% endif %}
</div>
</div>