@nuvler/cli 0.5.13 → 0.5.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -154,7 +154,7 @@ function Footer({ site, pages }: FooterProps) {
154
154
  const contact = site.settings?.contact;
155
155
  return <footer className="atelier-footer">
156
156
  <div className="atelier-container atelier-footer-grid">
157
- <div className="atelier-footer-brand"><span className="atelier-brand-mark">N</span><h2>{name}</h2><p>{site.settings?.description || "Produtos selecionados, informação clara e atendimento próximo."}</p></div>
157
+ <div className="atelier-footer-brand">{(site.settings?.footerLogo ?? site.settings?.logo)?.url ? <AtelierImage image={site.settings?.footerLogo ?? site.settings?.logo} alt={name} /> : <span className="atelier-brand-mark">N</span>}<h2>{name}</h2><p>{site.settings?.description || "Produtos selecionados, informação clara e atendimento próximo."}</p></div>
158
158
  <div><small>Explore</small><a href="/produtos">Produtos</a><a href="/blog">Conteúdo</a><a href="/servicos">Serviços</a><a href="/cases">Cases</a></div>
159
159
  <div><small>Institucional</small>{pages.slice(0, 5).map((page) => <a href={`/${page.slug}`} key={page.slug}>{page.title}</a>)}</div>
160
160
  <div><small>Atendimento</small>{contact?.whatsapp && <a href={`https://wa.me/${contact.whatsapp.replace(/\D/g, "")}`}>WhatsApp</a>}{contact?.email && <a href={`mailto:${contact.email}`}>{contact.email}</a>}{contact?.phone && <a href={`tel:${contact.phone}`}>{contact.phone}</a>}<p>{contact?.address}</p></div>
@@ -186,7 +186,7 @@ function Home({ sections, products, posts, services, cases, site, template }: Ho
186
186
  const editorial = [...posts, ...cases].slice(0, 3);
187
187
  const bannerSections = sections.filter((section) => section.enabled && section.type === "banner-carousel");
188
188
  return <main>
189
- <section className="atelier-hero atelier-container">
189
+ <section id={hero?.reference} style={{ scrollMarginTop: "100px" }} className="atelier-hero atelier-container">
190
190
  <div className="atelier-hero-copy"><span className="atelier-kicker">Nuvler Atelier · edição 01</span><h1>{heroTitle}</h1><p>{heroDescription}</p><div><a className="atelier-button atelier-button-light" href={heroUrl}>{heroButton}<b>↗</b></a><a className="atelier-text-link" href="/produtos">Ver catálogo completo →</a></div></div>
191
191
  <div className="atelier-hero-visual">
192
192
  <span className="atelier-orbit" /><span className="atelier-orbit second" />
@@ -194,7 +194,7 @@ function Home({ sections, products, posts, services, cases, site, template }: Ho
194
194
  {highlight && <a href={productUrl(highlight)}><small>Destaque da semana</small><strong>{highlight.title}</strong><span>{showPrices ? price(highlight) || "Conheça o produto" : "Conheça o produto"} →</span></a>}
195
195
  </div>
196
196
  </section>
197
- {bannerSections.map((section, index) => <AtelierBannerCarousel section={section} key={section.id || index} />)}
197
+ {bannerSections.map((section, index) => section.reference ? <div id={section.reference} style={{ scrollMarginTop: "100px" }} key={section.id || index}><AtelierBannerCarousel section={section} /></div> : <AtelierBannerCarousel section={section} key={section.id || index} />)}
198
198
  <section className="atelier-marquee"><div>{template.benefits.concat(template.benefits).map((benefit, index) => <span key={`${benefit.title}-${index}`}><b>✦</b>{benefit.title}<small>{benefit.description}</small></span>)}</div></section>
199
199
  <section className="atelier-section atelier-container">
200
200
  <header className="atelier-section-heading"><div><span className="atelier-kicker">Seleção essencial</span><h2>Produtos que merecem atenção</h2></div><p>Uma vitrine com mais respiro, imagens protagonistas e as informações certas para decidir.</p><a href="/produtos">Explorar tudo ↗</a></header>
@@ -4,6 +4,7 @@ import type {
4
4
  ThemeCartItem,
5
5
  ThemeEditorialItem,
6
6
  ThemeRoute,
7
+ ThemePageContent,
7
8
  ThemeSite,
8
9
  } from "@nuvler/theme-sdk";
9
10
  import { AtelierImage, plainText, themeDefinition } from "./definition.js";
@@ -31,6 +32,38 @@ function catalogHref(route: Extract<ThemeRoute, { type: "catalog" }>, page: numb
31
32
  return params.size ? `${pathname}?${params}` : pathname;
32
33
  }
33
34
 
35
+ function PageBlocks({ content }: { content: ThemePageContent }) {
36
+ return <div className="atelier-page-content">{content.blocks.map((block, index) => {
37
+ const data = block.data;
38
+ const key = block.id || `${block.type}-${index}`;
39
+ const text = (value: unknown) => typeof value === "string" ? plainText(value) : "";
40
+ if (block.type === "header") return <h2 key={key}>{text(data.text)}</h2>;
41
+ if (block.type === "paragraph") return <p key={key}>{text(data.text)}</p>;
42
+ if (block.type === "delimiter") return <hr key={key} />;
43
+ if (block.type === "quote") return <blockquote key={key}><p>{text(data.text)}</p>{text(data.caption) && <cite>{text(data.caption)}</cite>}</blockquote>;
44
+ if (block.type === "list") {
45
+ const items = Array.isArray(data.items) ? data.items : [];
46
+ const List = data.style === "ordered" ? "ol" : "ul";
47
+ return <List key={key}>{items.map((item, itemIndex) => <li key={itemIndex}>{text(item && typeof item === "object" && "content" in item ? (item as { content: unknown }).content : item)}</li>)}</List>;
48
+ }
49
+ if (block.type === "image") {
50
+ const image = data.file && typeof data.file === "object" ? data.file as Record<string, unknown> : {};
51
+ const url = typeof image.url === "string" ? image.url : "";
52
+ return url ? <figure key={key}><img src={url} alt={text(data.caption)} loading="lazy" />{text(data.caption) && <figcaption>{text(data.caption)}</figcaption>}</figure> : null;
53
+ }
54
+ if (block.type === "imageText") {
55
+ const image = data.image && typeof data.image === "object" ? data.image as Record<string, unknown> : {};
56
+ const url = typeof image.url === "string" ? image.url : "";
57
+ return <section className="atelier-page-image-text" key={key}>{url && <img src={url} alt={text(image.alt)} loading="lazy" />}<div>{text(data.title) && <h2>{text(data.title)}</h2>}{text(data.text) && <p>{text(data.text)}</p>}</div></section>;
58
+ }
59
+ if (block.type === "table") {
60
+ const rows = Array.isArray(data.content) ? data.content : [];
61
+ return <div className="atelier-page-table" key={key}><table><tbody>{rows.map((row, rowIndex) => <tr key={rowIndex}>{Array.isArray(row) ? row.map((cell, cellIndex) => <td key={cellIndex}>{text(cell)}</td>) : null}</tr>)}</tbody></table></div>;
62
+ }
63
+ return null;
64
+ })}</div>;
65
+ }
66
+
34
67
  function EditorialList({ title, basePath, items }: { title: string; basePath: string; items: ThemeEditorialItem[] }) {
35
68
  return <main className="atelier-page atelier-container">
36
69
  <header className="atelier-page-heading"><span className="atelier-kicker">Caderno Nuvler</span><h1>{title}</h1><p>Ideias, referências e histórias selecionadas para ajudar em cada escolha.</p></header>
@@ -115,7 +148,7 @@ export default function Theme({ context, route = { type: "home" }, sdk, adapters
115
148
  } else if (route.type === "editorial-detail") {
116
149
  content = <main className="atelier-page atelier-container"><article className="atelier-article"><span className="atelier-kicker">Caderno Nuvler</span><h1>{route.item.title}</h1><AtelierImage image={route.item.image || route.item.thumbnail || route.item.coverImage} alt={route.item.title} /><p>{route.item.description}</p><a href={route.basePath}>← Voltar</a></article></main>;
117
150
  } else if (route.type === "page") {
118
- content = <main className="atelier-page atelier-container"><header className="atelier-page-heading"><span className="atelier-kicker">Institucional</span><h1>{route.title}</h1></header></main>;
151
+ content = <main className="atelier-page atelier-container"><header className="atelier-page-heading"><span className="atelier-kicker">Institucional</span><h1>{route.title}</h1></header><PageBlocks content={route.content} /></main>;
119
152
  } else {
120
153
  content = <main className="atelier-page atelier-container"><header className="atelier-page-heading"><span className="atelier-kicker">{route.type === "loading" ? "Carregando" : "404"}</span><h1>{route.type === "loading" ? "Preparando sua experiência…" : "Essa página não foi encontrada."}</h1><a className="atelier-button atelier-button-dark" href="/">Voltar ao início</a></header></main>;
121
154
  }
@@ -64,7 +64,9 @@ node packages/cli/dist/nuvler.js theme dev \
64
64
  Para compilar, gerar o artefato ou publicar, execute na raiz do tooling:
65
65
 
66
66
  ```bash
67
- npm run pack:store
67
+ npm run pack:cli
68
+ npm run pack:default
69
+ npm publish ./artifacts/nuvler-cli-0.5.13.tgz --access public
68
70
  npm publish ./artifacts/nuvler-theme-default-1.1.7.tgz --access public
69
71
 
70
72
  node packages/cli/dist/nuvler.js theme build --theme themes/nuvler-default
@@ -2,7 +2,7 @@
2
2
  "schemaVersion": 1,
3
3
  "id": "nuvler-default",
4
4
  "name": "Nuvler Default",
5
- "version": "1.1.7",
5
+ "version": "1.1.13",
6
6
  "runtimeVersion": "1",
7
7
  "sdkVersion": "^1.3.3",
8
8
  "entry": "src/theme.tsx",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuvler/theme-default",
3
- "version": "1.1.7",
3
+ "version": "1.1.13",
4
4
  "description": "Tema padrão oficial da Nuvler",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -10,5 +10,6 @@ export interface NuvlerDefaultFooterProps extends FooterProps {
10
10
  export function Footer({ site, pages, template, platformBrand, ImageComponent = ThemeImageView }: NuvlerDefaultFooterProps) {
11
11
  const settings = site.settings;
12
12
  const name = settings?.siteName || site.tenant.name;
13
- return <footer className="store-footer"><div className="store-container footer-grid"><div className="footer-intro"><a className="footer-brand" href="/" aria-label={`${name} — início`}>{settings?.logo?.url ? <ImageComponent image={settings.logo} fallbackAlt={name} className="footer-logo" sizes="200px" fallbackWidth={240} fallbackHeight={96} /> : name}</a><p>{settings?.description || template.footerTagline}</p>{settings?.contact.whatsapp && <a className="footer-contact-cta" href={`https://wa.me/${settings.contact.whatsapp.replace(/\D/g, "")}`} target="_blank" rel="noreferrer">Fale pelo WhatsApp <span aria-hidden="true">→</span></a>}</div><div><strong>{template.footerNavigationLabel}</strong>{site.modules.includes("PRODUCTS") && <a href="/produtos">Todos os produtos</a>}{site.modules.includes("BLOG") && <a href="/blog">Blog</a>}{site.modules.includes("SERVICES") && <a href="/servicos">Serviços</a>}{site.modules.includes("CASES") && <a href="/cases">Cases</a>}<a href="/">Início</a></div>{pages.length > 0 && <div><strong>Institucional</strong>{pages.slice(0, 6).map((page) => <a key={page.slug} href={`/${page.slug}`}>{page.title}</a>)}</div>}<div><strong>Atendimento</strong>{settings?.contact.email && <a href={`mailto:${settings.contact.email}`}>{settings.contact.email}</a>}{settings?.contact.phone && <a href={`tel:${settings.contact.phone}`}>{settings.contact.phone}</a>}{settings?.contact.address && <span>{settings.contact.address}</span>}</div>{settings?.social && Object.values(settings.social).some(Boolean) && <div className="footer-social"><strong>{template.socialLabel}</strong>{settings.social.instagram && <a href={settings.social.instagram} target="_blank" rel="noreferrer">Instagram</a>}{settings.social.facebook && <a href={settings.social.facebook} target="_blank" rel="noreferrer">Facebook</a>}{settings.social.youtube && <a href={settings.social.youtube} target="_blank" rel="noreferrer">YouTube</a>}{settings.social.tiktok && <a href={settings.social.tiktok} target="_blank" rel="noreferrer">TikTok</a>}</div>}</div><div className="store-container footer-bottom"><span>© {new Date().getFullYear()} {name}</span><span>{template.footerNote}</span>{platformBrand && <span data-nuvler-platform-brand-slot>{platformBrand}</span>}</div></footer>;
13
+ const logo = settings?.footerLogo ?? settings?.logo;
14
+ return <footer className="store-footer"><div className="store-container footer-grid"><div className="footer-intro"><a className="footer-brand" href="/" aria-label={`${name} — início`}>{logo?.url ? <ImageComponent image={logo} fallbackAlt={name} className="footer-logo" sizes="200px" fallbackWidth={240} fallbackHeight={96} /> : name}</a><p>{settings?.description || template.footerTagline}</p>{settings?.contact.whatsapp && <a className="footer-contact-cta" href={`https://wa.me/${settings.contact.whatsapp.replace(/\D/g, "")}`} target="_blank" rel="noreferrer">Fale pelo WhatsApp <span aria-hidden="true">→</span></a>}</div><div><strong>{template.footerNavigationLabel}</strong>{site.modules.includes("PRODUCTS") && <a href="/produtos">Todos os produtos</a>}{site.modules.includes("BLOG") && <a href="/blog">Blog</a>}{site.modules.includes("SERVICES") && <a href="/servicos">Serviços</a>}{site.modules.includes("CASES") && <a href="/cases">Cases</a>}<a href="/">Início</a></div>{pages.length > 0 && <div><strong>Institucional</strong>{pages.slice(0, 6).map((page) => <a key={page.slug} href={`/${page.slug}`}>{page.title}</a>)}</div>}<div><strong>Atendimento</strong>{settings?.contact.email && <a href={`mailto:${settings.contact.email}`}>{settings.contact.email}</a>}{settings?.contact.phone && <a href={`tel:${settings.contact.phone}`}>{settings.contact.phone}</a>}{settings?.contact.address && <span>{settings.contact.address}</span>}</div>{settings?.social && Object.values(settings.social).some(Boolean) && <div className="footer-social"><strong>{template.socialLabel}</strong>{settings.social.instagram && <a href={settings.social.instagram} target="_blank" rel="noreferrer">Instagram</a>}{settings.social.facebook && <a href={settings.social.facebook} target="_blank" rel="noreferrer">Facebook</a>}{settings.social.youtube && <a href={settings.social.youtube} target="_blank" rel="noreferrer">YouTube</a>}{settings.social.tiktok && <a href={settings.social.tiktok} target="_blank" rel="noreferrer">TikTok</a>}</div>}</div><div className="store-container footer-bottom"><span>© {new Date().getFullYear()} {name}</span><span>{template.footerNote}</span>{platformBrand && <span data-nuvler-platform-brand-slot>{platformBrand}</span>}</div></footer>;
14
15
  }
@@ -673,6 +673,7 @@ export function Home({
673
673
  return (
674
674
  <>
675
675
  {visible.map((section, index) => {
676
+ const content = (() => {
676
677
  if (section.type === "hero")
677
678
  return (
678
679
  <Hero
@@ -814,6 +815,10 @@ export function Home({
814
815
  </div>
815
816
  </section>
816
817
  );
818
+ })();
819
+ return section.reference
820
+ ? <div key={section.id || index} id={section.reference} style={{ scrollMarginTop: "100px" }}>{content}</div>
821
+ : content;
817
822
  })}
818
823
  </>
819
824
  );
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
- import { useEffect, useMemo, useState, type CSSProperties } from "react";
3
+ import { useEffect, useMemo, useRef, useState, type CSSProperties } from "react";
4
4
  import {
5
5
  productUrl,
6
6
  type NuvlerStoreThemeDefinition,
@@ -9,7 +9,9 @@ import {
9
9
  type ThemeEditorialItem,
10
10
  type ThemeHomeSection,
11
11
  type ThemeNavigationItem,
12
+ type ThemePageContent,
12
13
  type ThemePageSummary,
14
+ type ThemeImage,
13
15
  type ThemeProduct,
14
16
  type ThemeRuntimeAdapters,
15
17
  type ThemeRuntimeSdk,
@@ -39,7 +41,8 @@ interface PreviewContext {
39
41
  }
40
42
 
41
43
  type PreviewRoute =
42
- | { type: "home" | "loading" | "not-found" | "page"; title?: string }
44
+ | { type: "home" | "loading" | "not-found"; title?: string }
45
+ | { type: "page"; title: string; slug: string; content: ThemePageContent }
43
46
  | {
44
47
  type: "catalog";
45
48
  products: ThemeProduct[];
@@ -68,6 +71,43 @@ type PreviewRoute =
68
71
  }
69
72
  | { type: "editorial-detail"; basePath: string; item: ThemeEditorialItem };
70
73
 
74
+ function PageBlocks({ content }: { content: ThemePageContent }) {
75
+ const text = (value: unknown): string => typeof value === "string" ? plainText(value) : "";
76
+ return <div className="article-content content-renderer">{content.blocks.map((block, index) => {
77
+ const data = block.data;
78
+ const key = block.id || `${block.type}-${index}`;
79
+ if (block.type === "header") {
80
+ const heading = text(data.text);
81
+ return Number(data.level) === 3 ? <h3 key={key}>{heading}</h3> : <h2 key={key}>{heading}</h2>;
82
+ }
83
+ if (block.type === "paragraph") return <p key={key}>{text(data.text)}</p>;
84
+ if (block.type === "delimiter") return <hr key={key} />;
85
+ if (block.type === "quote") return <blockquote key={key}><p>{text(data.text)}</p>{text(data.caption) && <cite>{text(data.caption)}</cite>}</blockquote>;
86
+ if (block.type === "list") {
87
+ const items = Array.isArray(data.items) ? data.items : [];
88
+ const List = data.style === "ordered" ? "ol" : "ul";
89
+ return <List key={key}>{items.map((item, itemIndex) => <li key={itemIndex}>{text(item && typeof item === "object" && "content" in item ? (item as { content: unknown }).content : item)}</li>)}</List>;
90
+ }
91
+ if (block.type === "image") {
92
+ const file = data.file && typeof data.file === "object" ? data.file as Record<string, unknown> : {};
93
+ const url = typeof file.url === "string" ? file.url : "";
94
+ const image: ThemeImage | null = url ? { url, alt: text(data.caption), width: null, height: null } : null;
95
+ return image ? <figure key={key}><ThemeImageView image={image} fallbackAlt={text(data.caption) || "Imagem do conteúdo"} />{text(data.caption) && <figcaption>{text(data.caption)}</figcaption>}</figure> : null;
96
+ }
97
+ if (block.type === "imageText") {
98
+ const rawImage = data.image && typeof data.image === "object" ? data.image as Record<string, unknown> : {};
99
+ const url = typeof rawImage.url === "string" ? rawImage.url : "";
100
+ const image: ThemeImage | null = url ? { url, alt: text(rawImage.alt), width: null, height: null } : null;
101
+ return <section className="content-image-text" key={key}>{image && <ThemeImageView image={image} fallbackAlt="Imagem do conteúdo" />}<div>{text(data.title) && <h2>{text(data.title)}</h2>}{text(data.text) && <p>{text(data.text)}</p>}</div></section>;
102
+ }
103
+ if (block.type === "table") {
104
+ const rows = Array.isArray(data.content) ? data.content : [];
105
+ return <div className="content-table" key={key}><table><tbody>{rows.map((row, rowIndex) => <tr key={rowIndex}>{Array.isArray(row) ? row.map((cell, cellIndex) => <td key={cellIndex}>{text(cell)}</td>) : null}</tr>)}</tbody></table></div>;
106
+ }
107
+ return null;
108
+ })}</div>;
109
+ }
110
+
71
111
  export interface NuvlerDefaultThemeProps {
72
112
  context: PreviewContext;
73
113
  route?: PreviewRoute;
@@ -227,7 +267,10 @@ export function createNuvlerDefaultRuntime(
227
267
  }: NuvlerDefaultThemeProps) {
228
268
  const [cartItems, setCartItems] = useState<PreviewCartItem[]>([]);
229
269
  const [cartOpen, setCartOpen] = useState(false);
270
+ const [cartToast, setCartToast] = useState<string | null>(null);
271
+ const [cartViewportHeight, setCartViewportHeight] = useState<number | null>(null);
230
272
  const [hydratedCartKey, setHydratedCartKey] = useState<string | null>(null);
273
+ const cartToastTimeout = useRef<ReturnType<typeof window.setTimeout> | null>(null);
231
274
  const cartStorageKey = `nuvler:cart:${context.store.slug}`;
232
275
 
233
276
  useEffect(() => {
@@ -245,6 +288,29 @@ export function createNuvlerDefaultRuntime(
245
288
  window.localStorage.setItem(cartStorageKey, JSON.stringify(cartItems));
246
289
  }, [cartItems, cartStorageKey, hydratedCartKey]);
247
290
 
291
+ useEffect(() => () => {
292
+ if (cartToastTimeout.current) window.clearTimeout(cartToastTimeout.current);
293
+ }, []);
294
+
295
+ useEffect(() => {
296
+ if (!cartOpen) return;
297
+
298
+ const viewport = window.visualViewport;
299
+ const syncCartViewportHeight = () =>
300
+ setCartViewportHeight(Math.round(viewport?.height ?? window.innerHeight));
301
+
302
+ syncCartViewportHeight();
303
+ window.addEventListener("resize", syncCartViewportHeight);
304
+ viewport?.addEventListener("resize", syncCartViewportHeight);
305
+ viewport?.addEventListener("scroll", syncCartViewportHeight);
306
+
307
+ return () => {
308
+ window.removeEventListener("resize", syncCartViewportHeight);
309
+ viewport?.removeEventListener("resize", syncCartViewportHeight);
310
+ viewport?.removeEventListener("scroll", syncCartViewportHeight);
311
+ };
312
+ }, [cartOpen]);
313
+
248
314
  const { Header, Footer, Home, ProductDetail, ProductGrid, NotFound } =
249
315
  themeDefinition.components;
250
316
  const site: ThemeSite = {
@@ -327,7 +393,12 @@ export function createNuvlerDefaultRuntime(
327
393
  );
328
394
  return [...current, { ...item, key, quantity: 1 }];
329
395
  });
330
- setCartOpen(true);
396
+ setCartToast(`“${item.title}” foi adicionado ao carrinho.`);
397
+ if (cartToastTimeout.current) window.clearTimeout(cartToastTimeout.current);
398
+ cartToastTimeout.current = window.setTimeout(() => {
399
+ setCartToast(null);
400
+ cartToastTimeout.current = null;
401
+ }, 3200);
331
402
  };
332
403
  const cartButton = (
333
404
  <button
@@ -587,7 +658,19 @@ export function createNuvlerDefaultRuntime(
587
658
  </article>
588
659
  </main>
589
660
  );
590
- } else if (route.type === "not-found")
661
+ } else if (route.type === "page")
662
+ content = (
663
+ <main className="article-page">
664
+ <article className="store-container article-shell">
665
+ <header className="article-header">
666
+ <span>Página</span>
667
+ <h1>{route.title}</h1>
668
+ </header>
669
+ <PageBlocks content={route.content} />
670
+ </article>
671
+ </main>
672
+ );
673
+ else if (route.type === "not-found")
591
674
  content = NotFound ? (
592
675
  <NotFound homeHref="/" />
593
676
  ) : (
@@ -639,10 +722,24 @@ export function createNuvlerDefaultRuntime(
639
722
  template={themeDefinition.template}
640
723
  />
641
724
  )}
725
+ {cartToast && (
726
+ <div className="cart-toast" role="status" aria-live="polite">
727
+ <span aria-hidden="true">✓</span>
728
+ <p>{cartToast}</p>
729
+ <button type="button" onClick={() => setCartToast(null)} aria-label="Fechar aviso">×</button>
730
+ </div>
731
+ )}
642
732
  {cartOpen && (
643
733
  <div
644
734
  className="cart-backdrop"
645
735
  role="presentation"
736
+ style={
737
+ cartViewportHeight
738
+ ? ({
739
+ "--cart-viewport-height": `${cartViewportHeight}px`,
740
+ } as CSSProperties)
741
+ : undefined
742
+ }
646
743
  onPointerDown={(event) =>
647
744
  event.target === event.currentTarget && setCartOpen(false)
648
745
  }
@@ -699,6 +796,12 @@ export function createNuvlerDefaultRuntime(
699
796
  <div className="cart-quantity">
700
797
  <button
701
798
  type="button"
799
+ className={item.quantity === 1 ? "cart-delete" : undefined}
800
+ aria-label={
801
+ item.quantity === 1
802
+ ? `Remover ${item.title} do carrinho`
803
+ : `Diminuir quantidade de ${item.title}`
804
+ }
702
805
  onClick={() =>
703
806
  setCartItems((current) =>
704
807
  current.flatMap((candidate) =>
@@ -716,7 +819,13 @@ export function createNuvlerDefaultRuntime(
716
819
  )
717
820
  }
718
821
  >
719
- −
822
+ {item.quantity === 1 ? (
823
+ <svg viewBox="0 0 24 24" aria-hidden="true">
824
+ <path d="M4 7h16M9 7V4h6v3m3 0-1 13H7L6 7m4 4v5m4-5v5" />
825
+ </svg>
826
+ ) : (
827
+ "−"
828
+ )}
720
829
  </button>
721
830
  <span>{item.quantity}</span>
722
831
  <button
@@ -739,19 +848,6 @@ export function createNuvlerDefaultRuntime(
739
848
  >
740
849
  +
741
850
  </button>
742
- <button
743
- type="button"
744
- className="cart-remove"
745
- onClick={() =>
746
- setCartItems((current) =>
747
- current.filter(
748
- (candidate) => candidate.key !== item.key,
749
- ),
750
- )
751
- }
752
- >
753
- Remover
754
- </button>
755
851
  </div>
756
852
  </div>
757
853
  </article>