<div class="n7-card grid
shadow-sm hover:shadow-lg">
<div class="n7-card__content grid gap-4
">
<div class="n7-card__heading flex flex-col-reverse gap-4">
<h3 class="n7-card__title text-2xl font-bold">
<a class="hover:underline" href="">
Componente card esempio
</a>
</h3>
<div class="n7-card__chips">
<ul class="flex gap-2 flex-wrap mt-auto" aria-label="Categorie">
<li><span class="n7-chip n7-chip--sm">
label</span></li>
<li><span class="n7-chip n7-chip--sm">
label</span></li>
<li><span class="n7-chip n7-chip--sm">
label</span></li>
<li><span class="n7-chip n7-chip--sm">
label</span></li>
</ul>
</div>
</div>
</div>
</article>
{% extends '@card' %}
{% block metadatas %}
{% if chips %}
<div class="n7-card__chips">
{% if chips %}
<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>
{% endif %}
{% endblock metadatas %}
{% block chips %}
{% endblock chips %}
{
"categoryText": "Categoria",
"iconSize": "w-24 h-24",
"titleClasses": "text-2xl font-bold",
"heading": "Componente card esempio",
"text": "Testo",
"descriptionClasses": "text-lg",
"ctaIcon": "mini--arrow-small-right",
"ctaLinkLabel": "Leggi di più",
"cardHeadingAlignment": "flex flex-col-reverse",
"boxShadow": "shadow-sm hover:shadow-lg",
"img": {
"path": "/images/feathers.jpg",
"alt": ""
},
"chips": true,
"description": false
}
/**
* CARD
*
*/
@layer components {
.n7-card {
@apply p-6 grid gap-6 bg-white;
}
/* CARD IN GRID COL */
.n7-col .n7-card {
@apply h-full;
}
/*.n7-card__heading.flex-col-reverse {
@apply justify-end;
}
/* .n7-card--event .n7-card__heading {
@apply gap-3;
} */
/*
.n7-card--event .n7-card__title {
@apply font-normal text-base leading-tight uppercase;
} */
/* CARD EVENT */
/* .n7-card--event {
@apply p-0;
} */
/* .n7-card--event .n7-card__content {
@apply ;
} */
}
/* 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 = (e) => {
// Verifica se è il tasto sinistro (0)
if (e.button === 0) {
down = +new Date();
}
}
card.onmouseup = (e) => {
// Procedi solo se è il tasto sinistro (0)
if (e.button === 0) {
up = +new Date();
if ((up - down) < 200) {
link.click();
}
}
}
});
Card component configurations.
Reference to card inclusive pattern by Heydon Pickering: https://inclusive-components.design/cards/
Fullclickable card is managed with a script; add the class
is-card-fullclickable
to the card and the script will manage the clickable area. Link is present only in card title <a>. In order to manage microinteractions and hover effects, Card has also transition hover:shadow-lg group classes; title link has also group-hover:underline class.
By default settings, card markup is made with article tag. However, that could not be always the right choice, article should be used for card representing a self-contained entity (e.g. a news item, a blog post, etc., with a heading, a date, an excerpt, a thumbnail, etc.). In some cases it might be better to use a div tag instead, and used in a list context (ul with role=”list”, and wrapped in a li item with class n7-col: e.g. in a list of links, for a card representing a link).
By default, card heading is h3. That means that card should be used in a section with a h2 heading labelling the section. This h2 could be visibile or sr-only. Sextions should always be labelled and identified by a heading. This should be discussed with the design team, if needed.
For development - Variable and configuration settings:
Add the component in the card with “true” value
Manage image thumb settings:
Blocks: