<article class="n7-card p-4
is-card-fullclickable transition hover:shadow-lg group">
<div class="grid gap-2.5 md:gap-4">
<div class="n7-card__heading flex flex-col-reverse gap-2.5 md:gap-4">
<h3 class="n7-card__title text-xl md:text-2xl font-bold">
<a class="hover:underline group-hover:underline" href="">
Componente card esempio
<span class="flex gap-0.5 items-center pt-1 md:pt-2 text-sm md:text-base font-medium n7-content-03">
<svg class="inline-block align-middle fill-current w-4 h-4 md:w-5 md:h-5" aria-hidden="true" focusable="false" role="img">
<use xlink:href="../../icons.svg#outline--document-text" />
</svg>
<span class="sr-only">, </span>PDF - 120Kb
</span>
</a>
</h3>
</div>
<p class="n7-card__excerpt text-sm md:text-base">
Testo aggiuntivo da configurazione
</p>
</div>
</article>
<article
class="n7-card{% block classes %}{% if classes %} {{ classes }}{% endif %}{% endblock %}
{% if hasSideThumb %} md:grid-cols-[min-content_1fr]{% endif %}
{% block fullClickable %}{% if fullClick %} is-card-fullclickable transition hover:shadow-lg group{% endif %}{% endblock fullClickable %}"
>
{% if thumb %}
<div class="n7-card__image{% if thumbSize %} {{ thumbSize }}{% endif %}
{% if thumbAspectRatio %} {{ thumbAspectRatio }}{% endif %}">
<img
class="{% if img.imgObjectFit %}{{ img.imgObjectFit }}{% else %}object-cover{% endif %} w-full h-full"
alt="{{ img.alt }}"
src="{{ img.path }}"
/>
</div>
{% endif %}
{% if icon %}
<div class="{% if iconSize %}{{ iconSize }}{% endif %} p-6{% if iconRadius %} {{ iconRadius }}{% else %} rounded{% endif %} {% if iconBg %} {{ iconBg }}{% else %}n7-background-gray-02{% endif %}">
{% render '@icon', { id: icon }, true %}
</div>
{% endif %}
<div class="grid{% if contentGap %} {{ contentGap }}{% else %} gap-4{% endif %}">
<div class="n7-card__heading flex flex-col-reverse{% if headingGap %} {{ headingGap }}{% else %} gap-4{% endif %}">
<h3 class="n7-card__title {{ headingClasses }}">
<a class="hover:underline{% if fullClick %} group-hover:underline{% endif %}" href="">
{{ heading | safe }}
{% block fileDetails %}
{% if fileDetails %}<span class="flex gap-0.5 items-center pt-1 md:pt-2 text-sm md:text-base font-medium n7-content-03">
{% render '@icon', { id: 'outline--document-text', size: 'w-4 h-4 md:w-5 md:h-5' }, true %}<span class="sr-only">, </span>PDF - 120Kb
</span>
{% endif %}
{% endblock fileDetails %}
{% if ctaLink %}<span class="sr-only">: Read more</span>{% endif %}
</a>
</h3>
{% if category or date %}
<div class="flex items-baseline justify-between">
{% if category %}
<div class="n7-card__categories">
{% render '@category--overline', { text: categoryText, classes: 'n7-content-placeholder'}, true %}
</div>
{% endif %}
{% if date %}
<div class="n7-card__date text-sm">
<time datetime="2023-09-30">30.09.2023</time>
</div>
{% endif %}
</div>
{% endif %}
</div>
{% block content %}
{% if 'is-empty' not in excerpt %}
<p class="n7-card__excerpt {{ excerptClasses }}">
{% if excerpt %}{{ excerpt | safe }}{% else %}Neque blandit pellentesque nunc sed amet. Nisl, semper sed aliquam amet proin purus augue et.{% endif %}
</p>
{% endif %}
{% endblock %}
{% if ctaLink %}
{% render '@link--has-icon', { hasIcon: 'true', icon: ctaIcon, label: 'Read more', allyHidden: 'true' } %}
{% endif %}
{% if cta %}
<div class="">
{% if fullClick %}
{% render '@button', { span: true, classes:'cursor-pointer', label: 'Card Cta'} %}
{% else %}
{% render '@button', { href:'#', classes: 'cursor-pointer', label: 'Card Cta'} %}
{% endif %}
</div>
{% endif %}
{% if tags %}
<ul class="flex gap-2 flex-wrap mt-auto" aria-label="Categorie">
{% for i in range(0,4) %}
<li>{% render '@chip--sm' %}</li>
{% endfor %}
</ul>
{% endif %}
</div>
</article>
{
"categoryText": "Categoria",
"iconSize": "w-24 h-24",
"headingClasses": "text-xl md:text-2xl font-bold",
"heading": "Componente card esempio",
"text": "Testo",
"excerpt": "Testo aggiuntivo da configurazione",
"excerptClasses": "text-sm md:text-base",
"ctaIcon": "mini--arrow-small-right",
"fullClick": true,
"classes": "p-4",
"contentGap": "gap-2.5 md:gap-4",
"headingGap": "gap-2.5 md:gap-4",
"fileDetails": true
}
/* From INCLUSIVE COMPONENT LIBRARY by Heydon Pickering
* https://inclusive-components.design/
* card pattern:
* https://inclusive-components.design/cards/
* Create redundant click event on the whole card, using only
* card heading link
* A click handler on the card's container element
* simply triggers the click method on the link inside it
* Add also a delay in click, in order to detect if the user is selecting the text and not clicking
*/
const cards = document.querySelectorAll('.n7-card.is-card-fullclickable');
Array.prototype.forEach.call(cards, card => {
let down, up, link = card.querySelector('.n7-card__title a');
card.style.cursor = 'pointer';
card.onmousedown = () => down = +new Date();
card.onmouseup = () => {
up = +new Date();
if ((up - down) < 200) {
link.click();
}
}
});
Card demo components example. Multiple variants and settings.
Variable settings:
Add the component in the card with “true” value
Manage image thumb settings: