Aller au contenu

🌅 HérosGratuit · 0 NahnahPar NAHNAH AI

Héros barre de recherche

Titre centré et grande barre de recherche Shopify, suivie de recherches suggérées en pastilles ; image de fond facultative sous un voile.

Aperçu en direct

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

Photos : Unsplash / Pexels (exemples de l’aperçu, jamais inclus dans le code).

Code à copier

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

{%- comment -%} NAHNAH AI · Héros barre de recherche (bibliothèque Sections & effets) {%- endcomment -%}
<div class="nn-hero-recherche" 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-voile: {{ section.settings.voile | divided_by: 100.0 }};">
  <div class="nn-hero-recherche__cadre{% if section.settings.image != blank %} nn-hero-recherche--image{% endif %}">
    {%- if section.settings.image != blank -%}
      <div class="nn-hero-recherche__media">{{ section.settings.image | image_url: width: 1800 | image_tag: class: 'nn-hero-recherche__img', sizes: '100vw', widths: '600, 900, 1200, 1800', loading: 'eager', alt: '' }}</div>
      <div class="nn-hero-recherche__voile" aria-hidden="true"></div>
    {%- endif -%}
    <span class="nn-hero-recherche__halo" aria-hidden="true"></span>
    <div class="nn-hero-recherche__contenu">
    {%- if section.settings.surtitre != blank -%}
      <p class="nn-hero-recherche__surtitre">{{ section.settings.surtitre | escape }}</p>
    {%- endif -%}
    {%- if section.settings.titre != blank -%}
      <h2 class="nn-hero-recherche__titre">{{ section.settings.titre }}</h2>
    {%- endif -%}
    {%- if section.settings.texte != blank -%}
      <div class="nn-hero-recherche__texte">{{ section.settings.texte }}</div>
    {%- endif -%}
      <form class="nn-hero-recherche__form" action="{{ routes.search_url }}" method="get" role="search">
        <label class="nn-hero-recherche__vh" for="NnRecherche-{{ section.id }}">Rechercher dans la boutique</label>
        <div class="nn-hero-recherche__barre">
          <span class="nn-hero-recherche__loupe"><svg aria-hidden="true" focusable="false" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="7"/><path d="M20 20l-3.5-3.5"/></svg></span>
          <input class="nn-hero-recherche__champ" id="NnRecherche-{{ section.id }}" type="search" name="q" placeholder="{{ section.settings.placeholder | escape }}" autocomplete="off">
          <input type="hidden" name="options[prefix]" value="last">
          <button class="nn-hero-recherche__bouton" type="submit">Rechercher</button>
        </div>
      </form>
      {%- if section.settings.suggestions != blank -%}
        {%- assign suggestions = section.settings.suggestions | split: ',' -%}
        <div class="nn-hero-recherche__suggestions">
          {%- if section.settings.titre_suggestions != blank -%}<p class="nn-hero-recherche__suggestions-titre">{{ section.settings.titre_suggestions | escape }}</p>{%- endif -%}
          <ul class="nn-hero-recherche__pastilles" role="list">
            {%- for suggestion in suggestions -%}
              {%- assign terme = suggestion | strip -%}
              {%- if terme != blank -%}<li><a class="nn-hero-recherche__pastille" href="{{ routes.search_url }}?q={{ terme | url_encode }}">{{ terme | escape }}</a></li>{%- endif -%}
            {%- endfor -%}
          </ul>
        </div>
      {%- endif -%}
    </div>
  </div>
</div>

{% schema %}
{
  "name": "Héros barre de recherche",
  "tag": "section",
  "class": "nn-section-hero-recherche",
  "settings": [
    {
      "type": "image_picker",
      "id": "image",
      "label": "Image de fond (facultative)"
    },
    {
      "type": "range",
      "id": "voile",
      "label": "Opacité du voile sur l’image",
      "min": 0,
      "max": 95,
      "step": 5,
      "default": 70,
      "unit": "%"
    },
    {
      "type": "text",
      "id": "surtitre",
      "label": "Sur-titre (vide : masqué)",
      "default": "Plus de choix, moins de recherche"
    },
    {
      "type": "inline_richtext",
      "id": "titre",
      "label": "Titre",
      "default": "Que cherches-tu aujourd’hui ?"
    },
    {
      "type": "richtext",
      "id": "texte",
      "label": "Texte",
      "default": "<p>Tape un nom de produit, une marque ou une référence.</p>"
    },
    {
      "type": "header",
      "content": "Recherche"
    },
    {
      "type": "text",
      "id": "placeholder",
      "label": "Texte indicatif du champ",
      "default": "Rechercher un produit…"
    },
    {
      "type": "text",
      "id": "titre_suggestions",
      "label": "Titre des suggestions (vide : masqué)",
      "default": "Recherches populaires :"
    },
    {
      "type": "text",
      "id": "suggestions",
      "label": "Suggestions (séparées par des virgules, vide : masquées)",
      "default": "Nouveautés, Cadeaux, Petits prix, Accessoires"
    },
    {
      "type": "header",
      "content": "Couleurs"
    },
    {
      "type": "color",
      "id": "couleur_fond",
      "label": "Fond",
      "default": "#0E2A47"
    },
    {
      "type": "color",
      "id": "couleur_texte",
      "label": "Texte",
      "default": "#FFFFFF"
    },
    {
      "type": "color",
      "id": "couleur_accent",
      "label": "Accent",
      "default": "#46C2FF"
    },
    {
      "type": "color",
      "id": "couleur_bouton",
      "label": "Bouton",
      "default": "#46C2FF"
    },
    {
      "type": "color",
      "id": "couleur_texte_bouton",
      "label": "Texte du bouton",
      "default": "#0E2A47"
    },
    {
      "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 barre de recherche"
    }
  ]
}
{% endschema %}

{% stylesheet %}
.nn-hero-recherche {
  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-recherche *, .nn-hero-recherche *::before, .nn-hero-recherche *::after { box-sizing: border-box; }
.nn-hero-recherche :where(a, button):focus-visible { outline: 3px solid var(--nn-accent); outline-offset: 3px; }
.nn-hero-recherche__surtitre { margin: 0 0 12px; font-size: 13px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--nn-accent); }
.nn-hero-recherche__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-recherche__texte { margin: 0 0 28px; font-size: clamp(16px, 1.6vw, 19px); line-height: 1.6; opacity: 0.88; max-width: 560px; }
.nn-hero-recherche__texte p { margin: 0 0 0.6em; }
.nn-hero-recherche__boutons { display: flex; flex-wrap: wrap; gap: 12px; }
.nn-hero-recherche__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-recherche__bouton--second { background: transparent; color: inherit; box-shadow: inset 0 0 0 2px currentColor; }
@media (hover: hover) {
  .nn-hero-recherche__bouton:hover { transform: translateY(-2px); box-shadow: 0 12px 26px color-mix(in srgb, var(--nn-bouton) 35%, transparent); }
  .nn-hero-recherche__bouton--second:hover { box-shadow: inset 0 0 0 2px currentColor, 0 12px 26px rgba(0, 0, 0, 0.12); }
}
.nn-hero-recherche__vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nn-hero-recherche__cadre { position: relative; overflow: hidden; isolation: isolate; padding: clamp(64px, 11vw, 140px) 16px; text-align: center; }
.nn-hero-recherche__media { position: absolute; inset: 0; z-index: -3; }
.nn-hero-recherche__img { display: block; width: 100%; height: 100%; object-fit: cover; }
.nn-hero-recherche__voile { position: absolute; inset: 0; z-index: -2; background: var(--nn-fond); opacity: var(--nn-voile); }
.nn-hero-recherche__halo { position: absolute; z-index: -1; left: 50%; top: 40%; width: min(640px, 120%); aspect-ratio: 2; margin-left: max(-320px, -60%); border-radius: 50%; background: var(--nn-accent); opacity: 0.18; filter: blur(80px); pointer-events: none; animation: nn-hero-recherche-respire 8s ease-in-out infinite; }
@keyframes nn-hero-recherche-respire { 50% { transform: scale(1.15); opacity: 0.26; } }
.nn-hero-recherche__contenu { position: relative; max-width: 760px; margin: 0 auto; }
.nn-hero-recherche__texte { margin-inline: auto; }
.nn-hero-recherche__form { margin: 0 auto; max-width: 680px; }
.nn-hero-recherche__barre { display: flex; align-items: center; gap: 6px; padding: 6px; border-radius: 999px; background: #fff; color: #141414; box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.5); }
.nn-hero-recherche__barre:focus-within { box-shadow: 0 0 0 3px var(--nn-accent), 0 20px 50px -20px rgba(0, 0, 0, 0.5); }
.nn-hero-recherche__loupe { display: grid; place-items: center; flex: none; width: 40px; color: #555; }
.nn-hero-recherche__loupe svg { width: 22px; height: 22px; }
.nn-hero-recherche__champ { flex: 1 1 auto; min-width: 0; min-height: 48px; padding: 0 4px; border: 0; background: transparent; color: #141414; font: inherit; font-size: 17px; outline: none; }
.nn-hero-recherche__champ::placeholder { color: #6b6b6b; }
.nn-hero-recherche__bouton { flex: none; min-height: 48px; padding: 12px 22px; border: 0; border-radius: 999px; font-family: inherit; cursor: pointer; }
@media (max-width: 479px) {
  .nn-hero-recherche__barre { flex-wrap: wrap; border-radius: 22px; }
  .nn-hero-recherche__champ { flex-basis: calc(100% - 50px); }
  .nn-hero-recherche__bouton { flex: 1 1 100%; }
}
.nn-hero-recherche__suggestions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; margin-top: 22px; }
.nn-hero-recherche__suggestions-titre { margin: 0; font-size: 14px; opacity: 0.8; }
.nn-hero-recherche__pastilles { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0; padding: 0; list-style: none; }
.nn-hero-recherche__pastille { display: inline-flex; align-items: center; min-height: 40px; padding: 8px 16px; border: 1px solid color-mix(in srgb, var(--nn-texte) 35%, transparent); border-radius: 999px; color: inherit; font-size: 14px; text-decoration: none; transition: background-color 0.2s ease, border-color 0.2s ease; }
@media (hover: hover) { .nn-hero-recherche__pastille:hover { border-color: var(--nn-accent); background: color-mix(in srgb, var(--nn-accent) 18%, transparent); } }
@media (prefers-reduced-motion: reduce) {
  .nn-hero-recherche, .nn-hero-recherche *, .nn-hero-recherche *::before, .nn-hero-recherche *::after {
    animation: none !important;
    transition: none !important;
  }
}
{% endstylesheet %}
Télécharger le fichier .liquid

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

Prompt à copier

À coller dans Claude ou ChatGPT avec le fichier téléchargé (ou le code copié) : l’assistant t’aide à l’installer et à l’adapter à ta marque.

Tu es un expert des thèmes Shopify Online Store 2.0. Aide-moi à installer puis à adapter à ma marque cet élément gratuit de la bibliothèque NAHNAH AI.

Élément : « Héros barre de recherche » (Héros)
Description : Titre centré et grande barre de recherche Shopify, suivie de recherches suggérées en pastilles ; image de fond facultative sous un voile.
Page de l’élément (aperçu en direct) : https://ai.nahnah.shop/bibliotheque-shopify/hero-recherche
Fichier : nahnah-hero-recherche.liquid (bouton « Télécharger » de la page) ou le code copié avec le bouton « Copier » : je te le joins ou je le colle après ce message.
Emplacement dans le thème : sections/nahnah-hero-recherche.liquid (Liquid, puis {% stylesheet %} et {% javascript %}, dans ce seul fichier).

Étapes d’installation :
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-recherche ».
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.

Ce que j’attends de toi :
- Guide-moi pas à pas dans Shopify : Boutique en ligne → Thèmes → « … » → Modifier le code → dossier sections → Ajouter une section, puis Personnaliser → Ajouter une section.
- Propose-moi d’adapter les couleurs, les textes et les liens à ma marque : demande d’abord mes couleurs (codes hexadécimaux), mon ton et mes liens.
- Garde le bloc {% schema %} et tous ses réglages (identifiants, types, presets) : je dois pouvoir tout régler ensuite dans l’éditeur de thème.
- Rends-moi le fichier complet modifié, prêt à coller, sans faux avis, fausse urgence ni chiffre inventé.

Si tu as le connecteur NAHNAH AI (MCP), récupère directement le code exact avec l’outil obtenir_code_element (id : hero-recherche).

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-recherche ».
  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-recherche 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