NAHNAH AI

🌅 HérosGratuit · 0 NahnahPar NAHNAH AI

Héros image et texte

Grande image à côté d’un titre, d’un texte et de deux boutons ; image à gauche ou à droite, empilée sur mobile.

Aperçu en direct

Données de démonstration (produits, menus, textes d’exemple) : dans ta boutique, ce sont les tiennes.

Code à copier

Fichier complet sections/nahnah-hero-image-texte.liquid (Liquid, CSS et JS inclus).

{%- comment -%} NAHNAH AI · Héros image et texte (bibliothèque Sections & effets) {%- endcomment -%}
<div class="nn-hero-image-texte" style="--nn-mh: {{ section.settings.marge_haut }}px; --nn-mb: {{ section.settings.marge_bas }}px; --nn-fond: {{ section.settings.couleur_fond }}; --nn-texte: {{ section.settings.couleur_texte }}; --nn-accent: {{ section.settings.couleur_accent }}; --nn-bouton: {{ section.settings.couleur_bouton }}; --nn-texte-bouton: {{ section.settings.couleur_texte_bouton }}; --nn-arrondi: {{ section.settings.arrondi }}px;">
  <div class="nn-hero-image-texte__grille nn-hero-image-texte--image-{{ section.settings.position_image }}">
    <div class="nn-hero-image-texte__media nn-hero-image-texte__media--{{ section.settings.ratio }}">
      {%- if section.settings.image != blank -%}
        {{ section.settings.image | image_url: width: 1600 | image_tag: class: 'nn-hero-image-texte__img', sizes: '(min-width: 750px) 50vw, 100vw', widths: '600, 900, 1200, 1600', loading: 'eager' }}
      {%- else -%}
        {{ 'lifestyle-1' | placeholder_svg_tag: 'nn-hero-image-texte__img nn-hero-image-texte__img--vide' }}
      {%- endif -%}
    </div>
    <div class="nn-hero-image-texte__contenu">
    {%- if section.settings.surtitre != blank -%}
      <p class="nn-hero-image-texte__surtitre">{{ section.settings.surtitre | escape }}</p>
    {%- endif -%}
    {%- if section.settings.titre != blank -%}
      <h2 class="nn-hero-image-texte__titre">{{ section.settings.titre }}</h2>
    {%- endif -%}
    {%- if section.settings.texte != blank -%}
      <div class="nn-hero-image-texte__texte">{{ section.settings.texte }}</div>
    {%- endif -%}
    {%- if section.settings.bouton_texte != blank or section.settings.bouton2_texte != blank -%}
      <div class="nn-hero-image-texte__boutons">
        {%- if section.settings.bouton_texte != blank -%}
          <a class="nn-hero-image-texte__bouton" href="{{ section.settings.bouton_lien | default: routes.all_products_collection_url }}">{{ section.settings.bouton_texte | escape }}</a>
        {%- endif -%}
        {%- if section.settings.bouton2_texte != blank -%}
          <a class="nn-hero-image-texte__bouton nn-hero-image-texte__bouton--second" href="{{ section.settings.bouton2_lien | default: routes.collections_url }}">{{ section.settings.bouton2_texte | escape }}</a>
        {%- endif -%}
      </div>
    {%- endif -%}
    </div>
  </div>
</div>

{% schema %}
{
  "name": "Héros image et texte",
  "tag": "section",
  "class": "nn-section-hero-image-texte",
  "settings": [
    {
      "type": "image_picker",
      "id": "image",
      "label": "Image"
    },
    {
      "type": "select",
      "id": "position_image",
      "label": "Position de l’image (ordinateur)",
      "options": [
        {
          "value": "gauche",
          "label": "À gauche"
        },
        {
          "value": "droite",
          "label": "À droite"
        }
      ],
      "default": "droite"
    },
    {
      "type": "select",
      "id": "ratio",
      "label": "Format de l’image",
      "options": [
        {
          "value": "paysage",
          "label": "Paysage"
        },
        {
          "value": "carre",
          "label": "Carré"
        },
        {
          "value": "portrait",
          "label": "Portrait"
        }
      ],
      "default": "portrait"
    },
    {
      "type": "range",
      "id": "arrondi",
      "label": "Arrondi de l’image",
      "min": 0,
      "max": 40,
      "step": 2,
      "default": 16,
      "unit": "px"
    },
    {
      "type": "text",
      "id": "surtitre",
      "label": "Sur-titre (vide : masqué)",
      "default": "Nouvelle collection"
    },
    {
      "type": "inline_richtext",
      "id": "titre",
      "label": "Titre",
      "default": "Des essentiels pensés pour durer"
    },
    {
      "type": "richtext",
      "id": "texte",
      "label": "Texte",
      "default": "<p>Matières choisies, finitions soignées et livraison suivie : découvre les pièces qui accompagneront ton quotidien.</p>"
    },
    {
      "type": "header",
      "content": "Boutons"
    },
    {
      "type": "text",
      "id": "bouton_texte",
      "label": "Texte du bouton (vide : masqué)",
      "default": "Découvrir la collection"
    },
    {
      "type": "url",
      "id": "bouton_lien",
      "label": "Lien du bouton (vide : tous les produits)"
    },
    {
      "type": "text",
      "id": "bouton2_texte",
      "label": "Texte du bouton secondaire (vide : masqué)",
      "default": "Notre histoire"
    },
    {
      "type": "url",
      "id": "bouton2_lien",
      "label": "Lien du bouton secondaire (vide : collections)"
    },
    {
      "type": "header",
      "content": "Couleurs"
    },
    {
      "type": "color",
      "id": "couleur_fond",
      "label": "Fond",
      "default": "#F7F5F0"
    },
    {
      "type": "color",
      "id": "couleur_texte",
      "label": "Texte",
      "default": "#1A1A1A"
    },
    {
      "type": "color",
      "id": "couleur_accent",
      "label": "Accent",
      "default": "#B8935A"
    },
    {
      "type": "color",
      "id": "couleur_bouton",
      "label": "Bouton",
      "default": "#1A1A1A"
    },
    {
      "type": "color",
      "id": "couleur_texte_bouton",
      "label": "Texte du bouton",
      "default": "#FFFFFF"
    },
    {
      "type": "header",
      "content": "Espacement"
    },
    {
      "type": "range",
      "id": "marge_haut",
      "label": "Marge haute",
      "min": 0,
      "max": 120,
      "step": 4,
      "unit": "px",
      "default": 0
    },
    {
      "type": "range",
      "id": "marge_bas",
      "label": "Marge basse",
      "min": 0,
      "max": 120,
      "step": 4,
      "unit": "px",
      "default": 0
    }
  ],
  "presets": [
    {
      "name": "Héros image et texte"
    }
  ]
}
{% endschema %}

{% stylesheet %}
.nn-hero-image-texte {
  position: relative;
  display: block;
  padding: var(--nn-mh) 0 var(--nn-mb);
  background: var(--nn-fond);
  color: var(--nn-texte);
  overflow-x: clip;
}
.nn-hero-image-texte *, .nn-hero-image-texte *::before, .nn-hero-image-texte *::after { box-sizing: border-box; }
.nn-hero-image-texte :where(a, button):focus-visible { outline: 3px solid var(--nn-accent); outline-offset: 3px; }
.nn-hero-image-texte__surtitre { margin: 0 0 12px; font-size: 13px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--nn-accent); }
.nn-hero-image-texte__titre { margin: 0 0 16px; font-size: clamp(32px, 6vw, 60px); line-height: 1.08; letter-spacing: -0.02em; overflow-wrap: anywhere; color: inherit; }
.nn-hero-image-texte__texte { margin: 0 0 28px; font-size: clamp(16px, 1.6vw, 19px); line-height: 1.6; opacity: 0.88; max-width: 560px; }
.nn-hero-image-texte__texte p { margin: 0 0 0.6em; }
.nn-hero-image-texte__boutons { display: flex; flex-wrap: wrap; gap: 12px; }
.nn-hero-image-texte__bouton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  max-width: 100%;
  padding: 14px 28px;
  border-radius: var(--nn-arrondi-bouton, 8px);
  background: var(--nn-bouton);
  color: var(--nn-texte-bouton);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.nn-hero-image-texte__bouton--second { background: transparent; color: inherit; box-shadow: inset 0 0 0 2px currentColor; }
@media (hover: hover) {
  .nn-hero-image-texte__bouton:hover { transform: translateY(-2px); box-shadow: 0 12px 26px color-mix(in srgb, var(--nn-bouton) 35%, transparent); }
  .nn-hero-image-texte__bouton--second:hover { box-shadow: inset 0 0 0 2px currentColor, 0 12px 26px rgba(0, 0, 0, 0.12); }
}
.nn-hero-image-texte__vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nn-hero-image-texte__grille {
  display: grid;
  gap: clamp(24px, 4vw, 64px);
  align-items: center;
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(24px, 5vw, 72px) 16px;
}
@media (min-width: 750px) {
  .nn-hero-image-texte__grille { grid-template-columns: 1.05fr 1fr; padding-inline: 32px; }
  .nn-hero-image-texte--image-gauche .nn-hero-image-texte__media { order: -1; }
  .nn-hero-image-texte--image-droite .nn-hero-image-texte__media { order: 2; }
}
.nn-hero-image-texte__media { position: relative; overflow: hidden; border-radius: var(--nn-arrondi); background: color-mix(in srgb, var(--nn-texte) 8%, transparent); }
.nn-hero-image-texte__media--paysage { aspect-ratio: 4 / 3; }
.nn-hero-image-texte__media--carre { aspect-ratio: 1; }
.nn-hero-image-texte__media--portrait { aspect-ratio: 4 / 5; }
.nn-hero-image-texte__img { display: block; width: 100%; height: 100%; object-fit: cover; animation: nn-hero-image-texte-zoom 1.2s ease both; }
.nn-hero-image-texte__contenu { animation: nn-hero-image-texte-entree 0.8s 0.1s ease both; }
.nn-hero-image-texte__surtitre { display: inline-flex; align-items: center; gap: 10px; }
.nn-hero-image-texte__surtitre::before { content: ""; width: 28px; height: 2px; background: currentColor; }
@keyframes nn-hero-image-texte-zoom { from { transform: scale(1.06); } }
@keyframes nn-hero-image-texte-entree { from { transform: translateY(18px); } }
@media (prefers-reduced-motion: reduce) {
  .nn-hero-image-texte, .nn-hero-image-texte *, .nn-hero-image-texte *::before, .nn-hero-image-texte *::after {
    animation: none !important;
    transition: none !important;
  }
}
{% endstylesheet %}

Licence NAHNAH AI : utilisation libre dans tes boutiques (y compris commerciales), modification permise, revente de l’élément seul interdite.

Installer dans ma boutique

En un clic, la section est ajoutée à un thème de ta boutique Shopify connectée (un thème non publié par défaut).

Chargement de tes boutiques…

Installer dans Shopify

  1. Dans Shopify : Boutique en ligne → Thèmes → bouton « … » du thème → Modifier le code.
  2. Dossier « sections » → « Ajouter une section » (ou « Nouveau fichier ») → nomme-la « nahnah-hero-image-texte ».
  3. Efface le contenu proposé, colle le code de l’onglet Liquid (fichier complet), puis Enregistrer.
  4. Ouvre Personnaliser → Ajouter une section → choisis-la, règle les textes et les couleurs, puis Enregistrer.

Installer via le MCP

Depuis Claude, Claude Code ou ChatGPT connecté à NAHNAH AI, demande : « Donne-moi le code de l’élément hero-image-texte de la bibliothèque NAHNAH AI et les étapes pour l’installer ». L’assistant récupère le code et les étapes (outil obtenir_code_element), gratuitement.

Boutique connectée à NAHNAH AI : l’assistant peut aussi l’installer directement (outil installer_element).

Connecter le MCP

Dans la même catégorie