<!-- RP 240322 - Changed classes -->
<article class="n7-card max-w-[476px] bg-transparent
   lg:grid-cols-[1fr_min-content]
   is-card-fullclickable">
    <div class="grid gap-4">
        <div class="n7-card__heading flex flex-col-reverse gap-2 px-4 lg:px-0">
            <h3 class="n7-card__title flex items-center gap-2 text-base font-medium n7-content-01">
                <a class="grow hover:underline" href="">
                    TriMix® gocce oculari: ora disponibile anche in formulazione monodose

                </a>
                <svg class="inline-block align-middle fill-current w-5 h-5 shrink-0" aria-hidden="true" focusable="false" role="img">
                    <use xlink:href="../../icons.svg#mini--arrow-right" />
                </svg>

            </h3>

            <!-- RP 240322 - Changed classes -->
            <div class="flex items-baseline justify-between">
                <div class="n7-card__date text-sm n7-content-03">
                    <time datetime="2024-01-17">17 Gennaio 2024</time>
                </div>
            </div>

        </div>

    </div>

    <!-- RP 240322 - Changed classes -->
    <div class="n7-card__image lg:w-32
   aspect-w-16 aspect-h-9">
        <img class="object-cover w-full h-full" alt="" src="/images/feathers.jpg" />
    </div>

</article>
<!-- RP 240322 - Changed classes -->
<article
  class="n7-card{% block classes %}{% if classes %} {{ classes }}{% endif %}{% endblock %}
  {% if hasSideThumb %} lg:grid-cols-[1fr_min-content]{% endif %}
  {% if fullClick %} is-card-fullclickable{% endif %}"
>
  <div class="grid gap-4">
    <div class="n7-card__heading flex flex-col-reverse gap-2 px-4 lg:px-0">
      <h3 class="n7-card__title flex items-center gap-2 {{ headingClasses }}">
        <a class="grow hover:underline" href="">
          {{ heading | safe }}
          {% if ctaLink %}<span class="sr-only">: Read more</span>{% endif %}
        </a>
        {% render '@icon--small', { id: 'mini--arrow-right', classes: 'shrink-0', size: 'w-5 h-5' }, true %}
      </h3>
      {% if date %}
        <!-- RP 240322 - Changed classes -->
        <div class="flex items-baseline justify-between">
          <div class="n7-card__date text-sm n7-content-03">
            <time datetime="2024-01-17">17 Gennaio 2024</time>
          </div>
        </div>
      {% endif %}
    </div>

    {% block content %}
      {% if 'is-empty' not in excerpt %}
        <p class="n7-card__excerpt {{ excerptClasses }}">
           {% if excerpt %}{{ excerpt }}{% else %}Neque blandit pellentesque nunc sed amet. Nisl, semper sed aliquam amet proin purus augue et.{% endif %}
        </p>
      {% endif %}
    {% endblock %} 
  </div>
  {% if thumb %}
  <!-- RP 240322 - Changed classes -->
  <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 %}
</article>
{
  "categoryText": "Categoria",
  "iconSize": "w-24 h-24",
  "headingClasses": "text-base font-medium n7-content-01",
  "heading": "TriMix® gocce oculari: ora disponibile anche in formulazione monodose",
  "headingIcon": true,
  "text": "Testo",
  "excerpt": "is-empty",
  "excerptClasses": "text-lg",
  "ctaIcon": "mini--arrow-small-right",
  "minisiteHidden": true,
  "classes": "max-w-[476px] bg-transparent",
  "fullClick": true,
  "date": true,
  "thumb": true,
  "thumbAspectRatio": "aspect-w-16 aspect-h-9",
  "hasSideThumb": true,
  "thumbSize": "lg:w-32",
  "img": {
    "path": "/images/feathers.jpg",
    "alt": "",
    "imgObjectFit": "object-cover"
  }
}
  • Content:
    /* 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();
            }
        }
    });
  • URL: /components/raw/card/card.js
  • Filesystem Path: components/03-molecules/card/card.js
  • Size: 853 Bytes

Card demo components example.

Variants and settings:

Variable settings:

  • classes: value - add eventual classes
  • categoryText: value - override category text if needed (default is “Categoria”)
  • heading: value - card title
  • headingClasses: value - add/change heading classes if needed
  • excerpt: value - excerpt text - text set by default in config, to disable in instance or card variant, use “is-hidden” value for this variable
  • excerptClasses: value - add/change excerpt classes if needed
  • icon: iconId - set top icon id and manage top icon visualization
  • iconSize: value - set icon width and height classes if needed (defaults are w-24 h-24)
  • iconRadius: value - manage top icon border radius - default rounded
  • iconBg: value - manage top icon background color - default n7-background-gray-02
  • ctaIcon: iconId - icon id for cta

Add the component in the card with “true” value

  • category: true (shows category)
  • ctaLink: true (shows cta link)
  • cta: true (shows cta button)
  • tags: true (shows tags list)
  • date: true (shows date)
  • thumb: true (shows thumb)
  • hasSideThumb: true (manage card class for side thumb - card grid class)
  • fullClick: true (Add the script which manage fullcard clickable area )

Manage image thumb settings:

  • img:
    • path: /pathto/image.jpg
    • alt: value - ‘Eventual alternative text if image is not descriptive’
    • imgObjectFit: value - manage img object fit if needed (default is cover)
  • thumbSize: value - manage thumb size if needed (for side thumb especially)
  • thumbAspectRatio: value - set aspect ratio classes if needed (used by default in has-thumb variant)