🌅 HérosGratuit · 0 NahnahPar NAHNAH AI
Héros promo code copiable
Héros promotionnel ou saisonnier : remise en très grand, code à copier en un clic (avec repli si la copie est bloquée), date de fin et confettis.
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-promo-code.liquid (Liquid, CSS et JS inclus).
{%- comment -%} NAHNAH AI · Héros promo code copiable (bibliothèque Sections & effets) {%- endcomment -%}
<nn-hero-promo-code class="nn-hero-promo-code" 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 }};">
<div class="nn-hero-promo-code__cadre nn-hero-promo-code--{{ section.settings.motif }}{% if section.settings.image != blank %} nn-hero-promo-code--image{% endif %}">
{%- unless section.settings.motif == 'aucun' -%}
<span class="nn-hero-promo-code__decor" aria-hidden="true"><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i></span>
{%- endunless -%}
<div class="nn-hero-promo-code__contenu">
{%- if section.settings.surtitre != blank -%}<p class="nn-hero-promo-code__surtitre">{{ section.settings.surtitre | escape }}</p>{%- endif -%}
{%- if section.settings.remise != blank -%}<p class="nn-hero-promo-code__remise">{{ section.settings.remise | escape }}</p>{%- endif -%}
{%- if section.settings.titre != blank -%}<h2 class="nn-hero-promo-code__titre">{{ section.settings.titre }}</h2>{%- endif -%}
{%- if section.settings.texte != blank -%}<div class="nn-hero-promo-code__texte">{{ section.settings.texte }}</div>{%- endif -%}
{%- if section.settings.code != blank -%}
<div class="nn-hero-promo-code__coupon">
<span class="nn-hero-promo-code__vh">Code promo :</span>
<code class="nn-hero-promo-code__code" data-nn-code>{{ section.settings.code | escape }}</code>
<button type="button" class="nn-hero-promo-code__copier" data-nn-copier data-copie="{{ section.settings.texte_copie | escape }}"><svg aria-hidden="true" focusable="false" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="11" height="11" rx="2"/><path d="M5 15V6a2 2 0 0 1 2-2h9"/></svg><span>{{ section.settings.texte_copier | escape }}</span></button>
</div>
<p class="nn-hero-promo-code__statut" role="status" data-nn-statut></p>
{%- endif -%}
{%- if section.settings.fin != blank -%}<p class="nn-hero-promo-code__fin">{{ section.settings.fin | escape }}</p>{%- endif -%}
{%- if section.settings.bouton_texte != blank -%}
<div class="nn-hero-promo-code__boutons">
{%- if section.settings.bouton_texte != blank -%}
<a class="nn-hero-promo-code__bouton" href="{{ section.settings.bouton_lien | default: routes.all_products_collection_url }}">{{ section.settings.bouton_texte | escape }}</a>
{%- endif -%}
</div>
{%- endif -%}
</div>
{%- if section.settings.image != blank -%}
<div class="nn-hero-promo-code__media">
{{ section.settings.image | image_url: width: 1200 | image_tag: class: 'nn-hero-promo-code__img', sizes: '(min-width: 900px) 40vw, 100vw', widths: '500, 800, 1200', loading: 'eager' }}
</div>
{%- endif -%}
</div>
</nn-hero-promo-code>
{% schema %}
{
"name": "Héros promo code copiable",
"tag": "section",
"class": "nn-section-hero-promo-code",
"settings": [
{
"type": "select",
"id": "motif",
"label": "Décor",
"options": [
{
"value": "confettis",
"label": "Confettis"
},
{
"value": "bulles",
"label": "Bulles"
},
{
"value": "aucun",
"label": "Aucun"
}
],
"default": "confettis"
},
{
"type": "image_picker",
"id": "image",
"label": "Image (facultative, à droite)"
},
{
"type": "text",
"id": "surtitre",
"label": "Sur-titre (vide : masqué)",
"default": "Offre de saison"
},
{
"type": "text",
"id": "remise",
"label": "Remise affichée en grand (vide : masquée)",
"default": "-15 %"
},
{
"type": "inline_richtext",
"id": "titre",
"label": "Titre",
"default": "Sur toute la boutique"
},
{
"type": "richtext",
"id": "texte",
"label": "Texte",
"default": "<p>Ajoute tes articles au panier et saisis le code au moment du paiement.</p>"
},
{
"type": "header",
"content": "Code promo"
},
{
"type": "paragraph",
"content": "Crée d’abord ce code dans Shopify (Réductions), sinon il ne fonctionnera pas au paiement."
},
{
"type": "text",
"id": "code",
"label": "Code (vide : masqué)",
"default": "SAISON15"
},
{
"type": "text",
"id": "texte_copier",
"label": "Texte du bouton de copie",
"default": "Copier"
},
{
"type": "text",
"id": "texte_copie",
"label": "Message après copie",
"default": "Code copié !"
},
{
"type": "text",
"id": "fin",
"label": "Validité (vide : masquée)",
"default": "Valable jusqu’à dimanche minuit"
},
{
"type": "header",
"content": "Boutons"
},
{
"type": "text",
"id": "bouton_texte",
"label": "Texte du bouton (vide : masqué)",
"default": "J’en profite"
},
{
"type": "url",
"id": "bouton_lien",
"label": "Lien du bouton (vide : tous les produits)"
},
{
"type": "header",
"content": "Couleurs"
},
{
"type": "color",
"id": "couleur_fond",
"label": "Fond",
"default": "#1A0F2E"
},
{
"type": "color",
"id": "couleur_texte",
"label": "Texte",
"default": "#FFFFFF"
},
{
"type": "color",
"id": "couleur_accent",
"label": "Accent",
"default": "#FF5FA2"
},
{
"type": "color",
"id": "couleur_bouton",
"label": "Bouton",
"default": "#FFD84D"
},
{
"type": "color",
"id": "couleur_texte_bouton",
"label": "Texte du bouton",
"default": "#1A0F2E"
},
{
"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 promo code copiable"
}
]
}
{% endschema %}
{% stylesheet %}
.nn-hero-promo-code {
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-promo-code *, .nn-hero-promo-code *::before, .nn-hero-promo-code *::after { box-sizing: border-box; }
.nn-hero-promo-code :where(a, button):focus-visible { outline: 3px solid var(--nn-accent); outline-offset: 3px; }
.nn-hero-promo-code__surtitre { margin: 0 0 12px; font-size: 13px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--nn-accent); }
.nn-hero-promo-code__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-promo-code__texte { margin: 0 0 28px; font-size: clamp(16px, 1.6vw, 19px); line-height: 1.6; opacity: 0.88; max-width: 560px; }
.nn-hero-promo-code__texte p { margin: 0 0 0.6em; }
.nn-hero-promo-code__boutons { display: flex; flex-wrap: wrap; gap: 12px; }
.nn-hero-promo-code__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-promo-code__bouton--second { background: transparent; color: inherit; box-shadow: inset 0 0 0 2px currentColor; }
@media (hover: hover) {
.nn-hero-promo-code__bouton:hover { transform: translateY(-2px); box-shadow: 0 12px 26px color-mix(in srgb, var(--nn-bouton) 35%, transparent); }
.nn-hero-promo-code__bouton--second:hover { box-shadow: inset 0 0 0 2px currentColor, 0 12px 26px rgba(0, 0, 0, 0.12); }
}
.nn-hero-promo-code__vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nn-hero-promo-code__cadre { position: relative; display: grid; gap: clamp(28px, 5vw, 64px); align-items: center; max-width: 1240px; margin: 0 auto; padding: clamp(56px, 9vw, 120px) 16px; overflow: hidden; isolation: isolate; text-align: center; }
@media (min-width: 900px) {
.nn-hero-promo-code__cadre { padding-inline: 32px; }
.nn-hero-promo-code--image { grid-template-columns: 1.1fr 0.9fr; text-align: left; }
.nn-hero-promo-code--image .nn-hero-promo-code__texte { margin-inline: 0; }
.nn-hero-promo-code--image .nn-hero-promo-code__coupon, .nn-hero-promo-code--image .nn-hero-promo-code__boutons { justify-content: flex-start; }
}
.nn-hero-promo-code__contenu { position: relative; min-width: 0; }
.nn-hero-promo-code__remise { margin: 0; font-size: clamp(64px, 16vw, 168px); font-weight: 900; line-height: 0.95; letter-spacing: -0.05em; color: var(--nn-accent); text-shadow: 0 6px 40px color-mix(in srgb, var(--nn-accent) 45%, transparent); overflow-wrap: anywhere; animation: nn-hero-promo-code-pulse 3s ease-in-out infinite; }
@keyframes nn-hero-promo-code-pulse { 50% { transform: scale(1.03); } }
.nn-hero-promo-code__titre { margin-top: 8px; }
.nn-hero-promo-code__texte { margin-inline: auto; }
.nn-hero-promo-code__coupon { display: flex; flex-wrap: wrap; align-items: stretch; justify-content: center; gap: 8px; margin: 0 0 6px; }
.nn-hero-promo-code__code { display: inline-flex; align-items: center; min-height: 52px; min-width: 0; max-width: 100%; padding: 10px 20px; border: 2px dashed var(--nn-bouton); border-radius: 12px; background: color-mix(in srgb, var(--nn-bouton) 10%, transparent); color: var(--nn-texte); font: 800 clamp(18px, 3vw, 24px) / 1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0.12em; overflow-wrap: anywhere; -webkit-user-select: all; user-select: all; }
.nn-hero-promo-code__copier { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 10px 20px; border: 0; border-radius: 12px; background: var(--nn-bouton); color: var(--nn-texte-bouton); font: inherit; font-weight: 700; cursor: pointer; transition: transform 0.2s ease; }
.nn-hero-promo-code__copier svg { width: 18px; height: 18px; }
@media (hover: hover) { .nn-hero-promo-code__copier:hover { transform: translateY(-2px); } }
.nn-hero-promo-code__statut { min-height: 1.4em; margin: 0 0 12px; font-size: 14px; font-weight: 600; color: var(--nn-bouton); }
.nn-hero-promo-code__fin { margin: 0 0 24px; font-size: 14px; opacity: 0.8; }
.nn-hero-promo-code__boutons { justify-content: center; }
.nn-hero-promo-code__bouton { border-radius: 999px; }
.nn-hero-promo-code__media { position: relative; overflow: hidden; border-radius: 28px; aspect-ratio: 1; transform: rotate(-2deg); box-shadow: 0 30px 60px -24px rgba(0, 0, 0, 0.5); }
.nn-hero-promo-code__img { display: block; width: 100%; height: 100%; object-fit: cover; }
.nn-hero-promo-code__decor { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.nn-hero-promo-code__decor i { position: absolute; top: -10%; width: 10px; height: 16px; border-radius: 2px; background: var(--nn-accent); opacity: 0.7; animation: nn-hero-promo-code-chute 9s linear infinite; }
.nn-hero-promo-code--bulles .nn-hero-promo-code__decor i { width: 14px; height: 14px; border-radius: 50%; opacity: 0.35; animation-name: nn-hero-promo-code-monte; top: auto; bottom: -10%; }
.nn-hero-promo-code__decor i:nth-child(odd) { background: var(--nn-bouton); }
.nn-hero-promo-code__decor i:nth-child(3n) { width: 8px; height: 8px; border-radius: 50%; }
.nn-hero-promo-code__decor i:nth-child(1) { left: 6%; animation-delay: -1s; }
.nn-hero-promo-code__decor i:nth-child(2) { left: 16%; animation-delay: -5s; animation-duration: 11s; }
.nn-hero-promo-code__decor i:nth-child(3) { left: 27%; animation-delay: -3s; }
.nn-hero-promo-code__decor i:nth-child(4) { left: 38%; animation-delay: -7s; animation-duration: 12s; }
.nn-hero-promo-code__decor i:nth-child(5) { left: 49%; animation-delay: -2s; }
.nn-hero-promo-code__decor i:nth-child(6) { left: 60%; animation-delay: -6s; animation-duration: 10s; }
.nn-hero-promo-code__decor i:nth-child(7) { left: 71%; animation-delay: -4s; }
.nn-hero-promo-code__decor i:nth-child(8) { left: 81%; animation-delay: -8s; animation-duration: 13s; }
.nn-hero-promo-code__decor i:nth-child(9) { left: 90%; animation-delay: -1.5s; }
.nn-hero-promo-code__decor i:nth-child(10) { left: 96%; animation-delay: -5.5s; animation-duration: 11s; }
@keyframes nn-hero-promo-code-chute { to { transform: translateY(1400%) rotate(540deg); } }
@keyframes nn-hero-promo-code-monte { to { transform: translateY(-1200%); } }
@media (prefers-reduced-motion: reduce) { .nn-hero-promo-code__decor { display: none; } }
@media (prefers-reduced-motion: reduce) {
.nn-hero-promo-code, .nn-hero-promo-code *, .nn-hero-promo-code *::before, .nn-hero-promo-code *::after {
animation: none !important;
transition: none !important;
}
}
{% endstylesheet %}
{% javascript %}
if (!customElements.get("nn-hero-promo-code")) {
// Copie du code promo : presse-papiers si le navigateur l'autorise, sinon sélection du code (Ctrl+C ou appui long)
customElements.define("nn-hero-promo-code", class extends HTMLElement {
connectedCallback() {
if (this.dataset.nnPret) return;
this.dataset.nnPret = "1";
var bouton = this.querySelector("[data-nn-copier]");
var code = this.querySelector("[data-nn-code]");
var statut = this.querySelector("[data-nn-statut]");
if (!bouton || !code) return;
var moi = this;
var annoncer = function (texte) {
if (statut) statut.textContent = texte;
clearTimeout(moi._minuterie);
moi._minuterie = setTimeout(function () { if (statut) statut.textContent = ""; }, 3000);
};
var selectionner = function () {
try {
var plage = document.createRange();
plage.selectNodeContents(code);
var choix = window.getSelection();
choix.removeAllRanges();
choix.addRange(plage);
annoncer("Code sélectionné : copie-le avec Ctrl+C ou un appui long.");
} catch (e) {}
};
bouton.addEventListener("click", function () {
var valeur = code.textContent.trim();
if (!navigator.clipboard || !navigator.clipboard.writeText) return selectionner();
try {
navigator.clipboard.writeText(valeur).then(function () { annoncer(bouton.getAttribute("data-copie") || "Code copié !"); }, selectionner);
} catch (e) { selectionner(); }
});
}
disconnectedCallback() {
clearTimeout(this._minuterie);
}
});
}
{% endjavascript %}
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 promo code copiable » (Héros)
Description : Héros promotionnel ou saisonnier : remise en très grand, code à copier en un clic (avec repli si la copie est bloquée), date de fin et confettis.
Page de l’élément (aperçu en direct) : https://ai.nahnah.shop/bibliotheque-shopify/hero-promo-code
Fichier : nahnah-hero-promo-code.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-promo-code.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-promo-code ».
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-promo-code).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
- Dans Shopify : Boutique en ligne → Thèmes → bouton « … » du thème → Modifier le code.
- Dossier « sections » → « Ajouter une section » (ou « Nouveau fichier ») → nomme-la « nahnah-hero-promo-code ».
- Efface le contenu proposé, colle le code de l’onglet Liquid (fichier complet), puis Enregistrer.
- 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-promo-code 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