@nuvler/cli 0.5.9 → 0.5.11
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.
- package/README.md +7 -5
- package/dist/api/theme-context.js.map +1 -1
- package/dist/commands/theme/create.js +1 -1
- package/dist/commands/theme/upgrade.js +2 -1
- package/dist/commands/theme/upgrade.js.map +1 -1
- package/dist/migrate/generator.js +21 -10
- package/dist/migrate/generator.js.map +1 -1
- package/dist/migrate/transformer.js +2 -1
- package/dist/migrate/transformer.js.map +1 -1
- package/dist/nuvler.js +118 -16
- package/dist/nuvler.js.map +1 -1
- package/dist/templates/nuvler-atelier/nuvler.theme.json +1 -1
- package/dist/templates/nuvler-atelier/package.json +3 -3
- package/dist/templates/nuvler-atelier/src/definition.tsx +16 -8
- package/dist/templates/nuvler-atelier/src/theme.css +3 -0
- package/dist/templates/nuvler-atelier/src/theme.tsx +24 -4
- package/dist/templates/nuvler-default/README.md +2 -2
- package/dist/templates/nuvler-default/nuvler.theme.json +22 -4
- package/dist/templates/nuvler-default/package.json +6 -5
- package/dist/templates/nuvler-default/scripts/verify-release.mjs +34 -0
- package/dist/templates/nuvler-default/src/carousel-frame.tsx +125 -20
- package/dist/templates/nuvler-default/src/header-interactions.tsx +2 -2
- package/dist/templates/nuvler-default/src/header.tsx +1 -1
- package/dist/templates/nuvler-default/src/home.tsx +700 -76
- package/dist/templates/nuvler-default/src/mini-banners.tsx +45 -0
- package/dist/templates/nuvler-default/src/product-carousel.tsx +2 -2
- package/dist/templates/nuvler-default/src/product-detail-interactive.tsx +7 -2
- package/dist/templates/nuvler-default/src/product-detail.tsx +3 -1
- package/dist/templates/nuvler-default/src/products.tsx +6 -5
- package/dist/templates/nuvler-default/src/shared.tsx +9 -1
- package/dist/templates/nuvler-default/src/theme-component.tsx +18 -4
- package/dist/templates/nuvler-default/src/theme.css +201 -7
- package/dist/templates/starter/package.json +2 -2
- package/dist/templates/starter/src/definition.tsx +5 -5
- package/dist/templates/starter/src/theme.tsx +2 -2
- package/package.json +3 -3
- package/preview-host/package.json +1 -1
- package/preview-host/src/fallback-context.json +1 -0
- package/preview-host/vendor/theme-runtime/default-theme.tsx +42 -6
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { ThemeImage, ThemeMiniBannerItem, ThemeMiniBannersLayout } from "@nuvler/theme-sdk";
|
|
2
|
+
import { ThemeImageView, type ThemeImageComponent } from "./shared.js";
|
|
3
|
+
|
|
4
|
+
function itemImage(item: ThemeMiniBannerItem): ThemeImage | null {
|
|
5
|
+
if (item.image?.url) return item.image;
|
|
6
|
+
if (!item.imageUrl) return null;
|
|
7
|
+
return {
|
|
8
|
+
url: item.imageUrl,
|
|
9
|
+
alt: item.imageAlt || item.title || "Mini banner",
|
|
10
|
+
width: null,
|
|
11
|
+
height: null,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function MiniBanner({ item, ImageComponent }: { item: ThemeMiniBannerItem; ImageComponent: ThemeImageComponent }) {
|
|
16
|
+
const image = itemImage(item);
|
|
17
|
+
if (!image) return null;
|
|
18
|
+
const content = (
|
|
19
|
+
<>
|
|
20
|
+
<span className="mini-banner-image">
|
|
21
|
+
<ImageComponent image={image} fallbackAlt={item.title || "Mini banner"} sizes="(max-width: 800px) 100vw, 50vw" fallbackWidth={800} fallbackHeight={450} />
|
|
22
|
+
</span>
|
|
23
|
+
{item.title && <strong>{item.title}</strong>}
|
|
24
|
+
{item.link && item.linkLabel && <span className="mini-banner-link-label">{item.linkLabel}</span>}
|
|
25
|
+
</>
|
|
26
|
+
);
|
|
27
|
+
return item.link
|
|
28
|
+
? <a className="mini-banner-card" href={item.link}>{content}</a>
|
|
29
|
+
: <div className="mini-banner-card">{content}</div>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function MiniBanners({ layout, items, ImageComponent = ThemeImageView }: {
|
|
33
|
+
layout: ThemeMiniBannersLayout;
|
|
34
|
+
items: ThemeMiniBannerItem[];
|
|
35
|
+
ImageComponent?: ThemeImageComponent;
|
|
36
|
+
}) {
|
|
37
|
+
if (!items.length) return null;
|
|
38
|
+
return (
|
|
39
|
+
<section className="store-section mini-banners-section">
|
|
40
|
+
<div className="store-container mini-banners-grid" data-layout={layout}>
|
|
41
|
+
{items.map((item, index) => <MiniBanner key={`${item.image?.url || item.imageUrl || "mini-banner"}-${index}`} item={item} ImageComponent={ImageComponent} />)}
|
|
42
|
+
</div>
|
|
43
|
+
</section>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
@@ -4,13 +4,13 @@ import { ProductCarouselFrame } from "./carousel-frame.js";
|
|
|
4
4
|
import { ProductCard } from "./products.js";
|
|
5
5
|
import type { ThemeImageComponent } from "./shared.js";
|
|
6
6
|
|
|
7
|
-
export function ProductCarousel({ products, showCategory, showDescription, ImageComponent }: { products: ThemeProduct[]; showCategory?: boolean; showDescription?: boolean; ImageComponent?: ThemeImageComponent }) {
|
|
7
|
+
export function ProductCarousel({ products, showPrices = true, showCategory, showDescription, ImageComponent }: { products: ThemeProduct[]; showPrices?: boolean; showCategory?: boolean; showDescription?: boolean; ImageComponent?: ThemeImageComponent }) {
|
|
8
8
|
if (!products.length) return <div className="empty-state"><span>7</span><h2>Nenhum produto encontrado</h2><p>Escolha outra categoria ou publique produtos para esta vitrine.</p></div>;
|
|
9
9
|
return (
|
|
10
10
|
<ProductCarouselFrame>
|
|
11
11
|
{products.map((product) => (
|
|
12
12
|
<div className="product-carousel-item" key={product.slug}>
|
|
13
|
-
<ProductCard product={product} showCategory={showCategory} showDescription={showDescription} ImageComponent={ImageComponent} />
|
|
13
|
+
<ProductCard product={product} showPrices={showPrices} showCategory={showCategory} showDescription={showDescription} ImageComponent={ImageComponent} />
|
|
14
14
|
</div>
|
|
15
15
|
))}
|
|
16
16
|
</ProductCarouselFrame>
|
|
@@ -70,6 +70,7 @@ interface ProductDetailInteractiveProps extends Omit<ProductDetailProps, "descri
|
|
|
70
70
|
|
|
71
71
|
export function ProductDetailInteractive({
|
|
72
72
|
product,
|
|
73
|
+
showPrices = true,
|
|
73
74
|
contact,
|
|
74
75
|
productUrl,
|
|
75
76
|
onAddToCart,
|
|
@@ -114,7 +115,11 @@ export function ProductDetailInteractive({
|
|
|
114
115
|
const selectedImage = images.find((image) => image.url === imageUrl) || images[0] || product.image;
|
|
115
116
|
const phone = contact?.whatsapp?.replace(/\D/g, "");
|
|
116
117
|
const variantDescription = variant?.values.map(({ name, value }) => `${name}: ${value}`).join(", ") || "";
|
|
117
|
-
const
|
|
118
|
+
const unitPrice = variant ? null : product.promotionalPrice ?? product.price;
|
|
119
|
+
const priceText = showPrices && typeof unitPrice === "number"
|
|
120
|
+
? ` Valor: ${new Intl.NumberFormat("pt-BR", { style: "currency", currency: "BRL" }).format(unitPrice)}.`
|
|
121
|
+
: "";
|
|
122
|
+
const message = `Olá! Gostaria de solicitar um orçamento para ${product.title}${variantDescription ? ` (${variantDescription})` : ""}${variant?.sku ? ` — ref. ${variant.sku}` : ""}.${priceText}${productUrl ? ` ${productUrl}` : ""}`;
|
|
118
123
|
const whatsapp = phone ? `https://wa.me/${phone}?text=${encodeURIComponent(message)}` : null;
|
|
119
124
|
const hasVariants = product.variantOptions.length > 0;
|
|
120
125
|
const outOfStock = product.stockQuantity === 0;
|
|
@@ -253,7 +258,7 @@ export function ProductDetailInteractive({
|
|
|
253
258
|
variantId: variant?.id,
|
|
254
259
|
variantName: variantDescription,
|
|
255
260
|
image: variant?.image || product.image,
|
|
256
|
-
unitPrice:
|
|
261
|
+
unitPrice: showPrices ? unitPrice : null,
|
|
257
262
|
})}
|
|
258
263
|
>Adicionar ao orçamento</button>}
|
|
259
264
|
{canPurchase && whatsapp && <a className={`button ${addToCart ? "button-secondary" : "button-primary"} button-block`} href={whatsapp} target="_blank" rel="noreferrer">Orçar somente este item</a>}
|
|
@@ -10,6 +10,7 @@ function discountPercent(price: number | null, promotionalPrice: number | null)
|
|
|
10
10
|
|
|
11
11
|
export function ProductDetail({
|
|
12
12
|
product,
|
|
13
|
+
showPrices = true,
|
|
13
14
|
contact,
|
|
14
15
|
productUrl,
|
|
15
16
|
descriptionContent,
|
|
@@ -84,7 +85,7 @@ export function ProductDetail({
|
|
|
84
85
|
const information = <>
|
|
85
86
|
{product.categories[0] && <span className="product-category">{product.categories[0].name}</span>}
|
|
86
87
|
<h1>{product.title}</h1>
|
|
87
|
-
<div className="product-price-block">{previousPrice && <s>{previousPrice}</s>}{currentPrice ? <strong>{currentPrice}</strong> : <span>Consulte condições com a loja</span>}{discount && <small>{discount}% de desconto</small>}</div>
|
|
88
|
+
{showPrices && <div className="product-price-block">{previousPrice && <s>De: {previousPrice}</s>}{currentPrice ? <strong>{previousPrice ? "por " : ""}{currentPrice}</strong> : <span>Consulte condições com a loja</span>}{discount && <small>{discount}% de desconto</small>}</div>}
|
|
88
89
|
{stockLabel && <p className={`product-availability${product.stockQuantity === 0 ? " unavailable" : ""}`}>{stockLabel}</p>}
|
|
89
90
|
{product.sku && <p className="product-reference">Ref. {product.sku}</p>}
|
|
90
91
|
<div className="product-description">{descriptionContent}</div>
|
|
@@ -95,6 +96,7 @@ export function ProductDetail({
|
|
|
95
96
|
return (
|
|
96
97
|
<ProductDetailInteractive
|
|
97
98
|
product={product}
|
|
99
|
+
showPrices={showPrices}
|
|
98
100
|
contact={contact}
|
|
99
101
|
productUrl={productUrl}
|
|
100
102
|
onAddToCart={onAddToCart}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { productUrl, type ProductGridProps, type ThemeProduct } from "@nuvler/theme-sdk";
|
|
2
2
|
import { ProductCardAction } from "./product-detail-interactive.js";
|
|
3
|
-
import { displayPrice, plainText, ThemeImageView, type ThemeImageComponent } from "./shared.js";
|
|
3
|
+
import { displayPrice, effectivePrice, plainText, ThemeImageView, type ThemeImageComponent } from "./shared.js";
|
|
4
4
|
|
|
5
5
|
function discountPercent(price: number | null, promotionalPrice: number | null) {
|
|
6
6
|
if (price === null || promotionalPrice === null || promotionalPrice >= price || price <= 0) return null;
|
|
7
7
|
return Math.round((1 - promotionalPrice / price) * 100);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export function ProductCard({ product, showCategory = true, showDescription = true, ImageComponent = ThemeImageView }: {
|
|
10
|
+
export function ProductCard({ product, showPrices = true, showCategory = true, showDescription = true, ImageComponent = ThemeImageView }: {
|
|
11
11
|
product: ThemeProduct;
|
|
12
|
+
showPrices?: boolean;
|
|
12
13
|
showCategory?: boolean;
|
|
13
14
|
showDescription?: boolean;
|
|
14
15
|
ImageComponent?: ThemeImageComponent;
|
|
@@ -20,10 +21,10 @@ export function ProductCard({ product, showCategory = true, showDescription = tr
|
|
|
20
21
|
const previousPrice = product.promotionalPrice !== null && product.price !== null && product.promotionalPrice < product.price
|
|
21
22
|
? displayPrice({ ...product, promotionalPrice: null })
|
|
22
23
|
: null;
|
|
23
|
-
return <article className="product-card" data-unavailable={unavailable || undefined}><a className="product-card-image" href={href} aria-label={`Ver ${product.title}`}>{discount && <span className="product-card-badge">-{discount}%</span>}{unavailable && <span className="product-card-stock">Indisponível</span>}<ImageComponent image={product.image} fallbackAlt={product.title} sizes="(max-width: 720px) 92vw, (max-width: 1100px) 45vw, 25vw" fallbackWidth={720} fallbackHeight={720} /></a><div className="product-card-content">{showCategory && <span className={`product-category${product.categories[0] ? "" : " product-category-empty"}`}>{product.categories[0]?.name || "Sem categoria"}</span>}<h3><a className="product-card-details-link" href={href}>{product.title}</a></h3>{showDescription && product.description && <p className="product-card-description">{plainText(product.description)}</p>}<div className="product-card-price">{previousPrice && <s>{previousPrice}</s>}{currentPrice ? <strong>{currentPrice}</strong> : <span>Consulte condições</span>}</div>{product.sku && <small className="product-card-sku">Ref. {product.sku}</small>}<ProductCardAction href={href} hasVariants={product.variantOptions.length > 0} unavailable={unavailable} item={{ productSlug: product.slug, productUrl: href, title: product.title, sku: product.sku, image: product.image, unitPrice:
|
|
24
|
+
return <article className="product-card" data-unavailable={unavailable || undefined}><a className="product-card-image" href={href} aria-label={`Ver ${product.title}`}>{showPrices && discount && <span className="product-card-badge">-{discount}%</span>}{unavailable && <span className="product-card-stock">Indisponível</span>}<ImageComponent image={product.image} fallbackAlt={product.title} sizes="(max-width: 720px) 92vw, (max-width: 1100px) 45vw, 25vw" fallbackWidth={720} fallbackHeight={720} /></a><div className="product-card-content">{showCategory && <span className={`product-category${product.categories[0] ? "" : " product-category-empty"}`}>{product.categories[0]?.name || "Sem categoria"}</span>}<h3><a className="product-card-details-link" href={href}>{product.title}</a></h3>{showDescription && product.description && <p className="product-card-description">{plainText(product.description)}</p>}{showPrices && <div className="product-card-price">{previousPrice && <s>De: {previousPrice}</s>}{currentPrice ? <strong>{previousPrice ? "por " : ""}{currentPrice}</strong> : <span>Consulte condições</span>}</div>}{product.sku && <small className="product-card-sku">Ref. {product.sku}</small>}<ProductCardAction href={href} hasVariants={product.variantOptions.length > 0} unavailable={unavailable} item={{ productSlug: product.slug, productUrl: href, title: product.title, sku: product.sku, image: product.image, unitPrice: showPrices ? effectivePrice(product) : null }} /></div></article>;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
export function ProductGrid({ products, columns = 4, showCategory = true, showDescription = true, ImageComponent = ThemeImageView }: ProductGridProps & { ImageComponent?: ThemeImageComponent }) {
|
|
27
|
+
export function ProductGrid({ products, columns = 4, showPrices = true, showCategory = true, showDescription = true, ImageComponent = ThemeImageView }: ProductGridProps & { ImageComponent?: ThemeImageComponent }) {
|
|
27
28
|
if (!products.length) return <div className="empty-state"><span>7</span><h2>Nenhum produto encontrado</h2><p>Novos itens aparecerão aqui assim que forem publicados.</p></div>;
|
|
28
|
-
return <div className="product-grid" data-columns={columns}>{products.map((product) => <ProductCard key={product.slug} product={product} showCategory={showCategory} showDescription={showDescription} ImageComponent={ImageComponent} />)}</div>;
|
|
29
|
+
return <div className="product-grid" data-columns={columns}>{products.map((product) => <ProductCard key={product.slug} product={product} showPrices={showPrices} showCategory={showCategory} showDescription={showDescription} ImageComponent={ImageComponent} />)}</div>;
|
|
29
30
|
}
|
|
@@ -44,8 +44,16 @@ export function plainText(value: string): string {
|
|
|
44
44
|
return htmlToPlainText(value);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
export function effectivePrice(product: ThemeProduct): number | null {
|
|
48
|
+
const promotionalPrice = product.promotionalPrice;
|
|
49
|
+
const price = product.price;
|
|
50
|
+
return typeof promotionalPrice === "number" && typeof price === "number" && promotionalPrice < price
|
|
51
|
+
? promotionalPrice
|
|
52
|
+
: price;
|
|
53
|
+
}
|
|
54
|
+
|
|
47
55
|
export function displayPrice(product: ThemeProduct): string | null {
|
|
48
|
-
const price = product
|
|
56
|
+
const price = effectivePrice(product);
|
|
49
57
|
return typeof price === "number"
|
|
50
58
|
? new Intl.NumberFormat("pt-BR", { style: "currency", currency: "BRL" }).format(price)
|
|
51
59
|
: null;
|
|
@@ -34,6 +34,10 @@ interface PreviewCartItem extends ThemeCartItem {
|
|
|
34
34
|
quantity: number;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
function money(value: number): string {
|
|
38
|
+
return new Intl.NumberFormat("pt-BR", { style: "currency", currency: "BRL" }).format(value);
|
|
39
|
+
}
|
|
40
|
+
|
|
37
41
|
function catalogHref(route: Extract<PreviewRoute, { type: "catalog" }>, page: number): string {
|
|
38
42
|
const params = new URLSearchParams();
|
|
39
43
|
if (route.search) params.set("busca", route.search);
|
|
@@ -93,8 +97,18 @@ export function createNuvlerDefaultRuntime(themeDefinition: NuvlerStoreThemeDefi
|
|
|
93
97
|
"--container-width": `${containerWidth}px`,
|
|
94
98
|
"--border-radius": `${borderRadius}px`,
|
|
95
99
|
} as CSSProperties;
|
|
100
|
+
const showPrices = site.settings?.catalog?.showPrices ?? true;
|
|
96
101
|
const cartCount = cartItems.reduce((total, item) => total + item.quantity, 0);
|
|
97
|
-
const
|
|
102
|
+
const cartTotal = cartItems.reduce((total, item) => total + (item.unitPrice ?? 0) * item.quantity, 0);
|
|
103
|
+
const hasCompletePrices = cartItems.length > 0 && cartItems.every(({ unitPrice }) => typeof unitPrice === "number");
|
|
104
|
+
const cartMessage = useMemo(() => {
|
|
105
|
+
const lines = cartItems.map((item, index) => {
|
|
106
|
+
const price = showPrices && typeof item.unitPrice === "number" ? `\nValor unitário: ${money(item.unitPrice)}` : "";
|
|
107
|
+
return `${index + 1}. ${item.quantity}x ${item.title}${item.variantName ? ` (${item.variantName})` : ""}${item.sku ? ` — ref. ${item.sku}` : ""}${price}`;
|
|
108
|
+
});
|
|
109
|
+
const summary = showPrices && hasCompletePrices ? `\n\nTotal estimado: ${money(cartTotal)}` : "";
|
|
110
|
+
return `Olá! Gostaria de solicitar um orçamento para os itens abaixo:\n\n${lines.join("\n\n")}${summary}`;
|
|
111
|
+
}, [cartItems, cartTotal, hasCompletePrices, showPrices]);
|
|
98
112
|
const whatsapp = site.settings?.contact.whatsapp?.replace(/\D/g, "");
|
|
99
113
|
const checkoutUrl = whatsapp && cartItems.length
|
|
100
114
|
? `https://wa.me/${whatsapp}?text=${encodeURIComponent(cartMessage)}`
|
|
@@ -111,15 +125,15 @@ export function createNuvlerDefaultRuntime(themeDefinition: NuvlerStoreThemeDefi
|
|
|
111
125
|
const cartButton = <button type="button" className="cart-button" onClick={() => setCartOpen(true)} aria-label={`Abrir carrinho com ${cartCount} itens`}><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3 4h2l2 11h10l2-8H6M9 20h.01M17 20h.01" /></svg>{cartCount > 0 && <span>{Math.min(cartCount, 99)}</span>}</button>;
|
|
112
126
|
let content;
|
|
113
127
|
if (route.type === "home") content = <main><Home sections={context.home.content.sections} products={context.catalog.products} posts={context.editorial.posts} services={context.editorial.services} cases={context.editorial.cases} site={site} submitContact={sdk?.contact?.submit} template={themeDefinition.template} /></main>;
|
|
114
|
-
else if (route.type === "product") content = <main className="product-page"><div className="store-container"><nav className="breadcrumbs" aria-label="Navegação estrutural"><a href="/">Início</a><span>/</span><a href="/produtos">Produtos</a><span>/</span><strong>{route.product.title}</strong></nav><ProductDetail product={route.product} contact={site.settings?.contact} productUrl={window.location.href} descriptionContent={<p>{plainText(route.product.description)}</p>} onAddToCart={addToCart} /></div></main>;
|
|
115
|
-
else if (route.type === "catalog") content = <main className="catalog-page"><section className="catalog-hero"><div className="store-container"><span>Nosso catálogo</span><h1>{route.search ? `Busca por “${route.search}”` : "Todos os produtos"}</h1><p>{route.pagination.total} produto(s)</p></div></section><div className="store-container catalog-layout"><aside className="category-filter catalog-filters"><form action={route.categoryPath.length ? `/${route.categoryPath.join("/")}` : "/produtos"} className="catalog-filter-form"><label htmlFor="preview-catalog-search">Buscar no catálogo</label><div className="catalog-filter-search"><input id="preview-catalog-search" name="busca" type="search" defaultValue={route.search} placeholder="Nome do produto" /><button type="submit" aria-label="Pesquisar">⌕</button></div></form>{route.facets.length > 0 && <form className="catalog-variant-filters">{route.search && <input type="hidden" name="busca" value={route.search} />}{route.facets.map((facet) => <fieldset className="catalog-filter-section" key={facet.name}><legend>{facet.name}</legend>{facet.values.map(({ value, count }) => { const token = `${facet.name}::${value}`; return <label className="catalog-filter-checkbox" key={token}><input type="checkbox" name="variante" value={token} defaultChecked={route.variants.includes(token)} /><span>{value}</span><small>{count}</small></label>; })}</fieldset>)}<button type="submit" className="button button-primary button-block">Aplicar filtros</button></form>}</aside><section className="catalog-results"><ProductGrid products={route.products} columns={site.settings?.catalog?.desktopColumns || 3} showCategory={site.settings?.catalog?.showCategory} showDescription={site.settings?.catalog?.showDescription} />{route.pagination.totalPages > 1 && <nav className="catalog-pagination" aria-label="Paginação dos produtos"><a className={route.pagination.hasPreviousPage ? "" : "disabled"} href={catalogHref(route, Math.max(1, route.pagination.page - 1))}><span>‹</span> Anterior</a><div className="catalog-pagination-pages"><span className="catalog-pagination-item"><a className="active" href={catalogHref(route, route.pagination.page)}>{route.pagination.page}</a></span></div><a className={route.pagination.hasNextPage ? "" : "disabled"} href={catalogHref(route, Math.min(route.pagination.totalPages, route.pagination.page + 1))}>Próxima <span>›</span></a></nav>}</section></div></main>;
|
|
128
|
+
else if (route.type === "product") content = <main className="product-page"><div className="store-container"><nav className="breadcrumbs" aria-label="Navegação estrutural"><a href="/">Início</a><span>/</span><a href="/produtos">Produtos</a><span>/</span><strong>{route.product.title}</strong></nav><ProductDetail product={route.product} showPrices={showPrices} contact={site.settings?.contact} productUrl={window.location.href} descriptionContent={<p>{plainText(route.product.description)}</p>} onAddToCart={addToCart} /></div></main>;
|
|
129
|
+
else if (route.type === "catalog") content = <main className="catalog-page"><section className="catalog-hero"><div className="store-container"><span>Nosso catálogo</span><h1>{route.search ? `Busca por “${route.search}”` : "Todos os produtos"}</h1><p>{route.pagination.total} produto(s)</p></div></section><div className="store-container catalog-layout"><aside className="category-filter catalog-filters"><form action={route.categoryPath.length ? `/${route.categoryPath.join("/")}` : "/produtos"} className="catalog-filter-form"><label htmlFor="preview-catalog-search">Buscar no catálogo</label><div className="catalog-filter-search"><input id="preview-catalog-search" name="busca" type="search" defaultValue={route.search} placeholder="Nome do produto" /><button type="submit" aria-label="Pesquisar">⌕</button></div></form>{route.facets.length > 0 && <form className="catalog-variant-filters">{route.search && <input type="hidden" name="busca" value={route.search} />}{route.facets.map((facet) => <fieldset className="catalog-filter-section" key={facet.name}><legend>{facet.name}</legend>{facet.values.map(({ value, count }) => { const token = `${facet.name}::${value}`; return <label className="catalog-filter-checkbox" key={token}><input type="checkbox" name="variante" value={token} defaultChecked={route.variants.includes(token)} /><span>{value}</span><small>{count}</small></label>; })}</fieldset>)}<button type="submit" className="button button-primary button-block">Aplicar filtros</button></form>}</aside><section className="catalog-results"><ProductGrid products={route.products} columns={site.settings?.catalog?.desktopColumns || 3} showPrices={showPrices} showCategory={site.settings?.catalog?.showCategory} showDescription={site.settings?.catalog?.showDescription} />{route.pagination.totalPages > 1 && <nav className="catalog-pagination" aria-label="Paginação dos produtos"><a className={route.pagination.hasPreviousPage ? "" : "disabled"} href={catalogHref(route, Math.max(1, route.pagination.page - 1))}><span>‹</span> Anterior</a><div className="catalog-pagination-pages"><span className="catalog-pagination-item"><a className="active" href={catalogHref(route, route.pagination.page)}>{route.pagination.page}</a></span></div><a className={route.pagination.hasNextPage ? "" : "disabled"} href={catalogHref(route, Math.min(route.pagination.totalPages, route.pagination.page + 1))}>Próxima <span>›</span></a></nav>}</section></div></main>;
|
|
116
130
|
else if (route.type === "editorial-list") { const meta = editorialMeta(route.basePath); content = <main className="editorial-list-page"><section className="theme-page-hero"><div className="store-container"><span className="page-kicker">{meta.eyebrow}</span><h1>{route.title}</h1></div></section><section className="store-section"><div className="store-container"><EditorialPreview items={route.items} basePath={route.basePath} /></div></section></main>; }
|
|
117
131
|
else if (route.type === "editorial-detail") { const meta = editorialMeta(route.basePath); const image = route.item.image || route.item.coverImage || route.item.thumbnail; content = <main className="article-page"><article className="store-container article-shell"><nav className="breadcrumbs" aria-label="Navegação estrutural"><a href="/">Início</a><span>/</span><a href={route.basePath}>{route.basePath === "/blog" ? "Blog" : route.basePath === "/servicos" ? "Serviços" : "Cases"}</a><span>/</span><strong>{route.item.title}</strong></nav><header className="article-header">{(route.item.category?.title || route.item.category?.name) ? <span>{route.item.category.title || route.item.category.name}</span> : <span>{meta.eyebrow}</span>}<h1>{route.item.title}</h1>{route.item.description && <p>{route.item.description}</p>}{publishedDate(route.item.publishedAt) && <small>{publishedDate(route.item.publishedAt)}</small>}</header>{image && <ThemeImageView image={image} fallbackAlt={route.item.title} className="article-cover" priority sizes="(max-width: 1100px) 100vw, 1040px" fallbackWidth={1600} fallbackHeight={900} />}<div className="article-content"><a className="text-link" href={route.basePath}>← Voltar para {route.basePath === "/blog" ? "o blog" : route.basePath === "/servicos" ? "serviços" : "cases"}</a></div></article></main>; }
|
|
118
132
|
else if (route.type === "not-found") content = NotFound ? <NotFound homeHref="/" /> : <main className="not-found-page"><div className="not-found-card"><span>404</span><h1>Conteúdo não encontrado</h1></div></main>;
|
|
119
133
|
else content = <main className="not-found-page"><div className="not-found-card"><span>Carregando</span><h1>{route.title || "Buscando conteúdo da loja"}</h1></div></main>;
|
|
120
134
|
// A 404 mantém a mesma moldura das demais páginas, inclusive o footer.
|
|
121
135
|
const isNotFound = false;
|
|
122
|
-
return <ThemeInteractionProvider onAddToCart={addToCart}><div className="store-shell nuvler-default-theme" data-theme-id={themeDefinition.manifest.id} data-theme-version={themeDefinition.manifest.version} style={style}><Header site={site} categories={context.navigation.categories} pages={context.navigation.pages} menu={context.navigation.menu} headerButton={context.navigation.headerButton} template={themeDefinition.template} searchProducts={adapters?.searchProducts} cart={cartButton} /><div className={`store-page${isNotFound ? " store-page-not-found" : ""}`}>{content}</div>{!isNotFound && <Footer site={site} pages={context.navigation.pages} template={themeDefinition.template} />}{cartOpen && <div className="cart-backdrop" role="presentation" onPointerDown={(event) => event.target === event.currentTarget && setCartOpen(false)}><aside className="cart-drawer" aria-label="Carrinho de orçamento"><div className="cart-heading"><div><small>Seu orçamento</small><strong>{cartCount} {cartCount === 1 ? "item" : "itens"}</strong></div><button type="button" onClick={() => setCartOpen(false)} aria-label="Fechar carrinho">×</button></div><div className="cart-items">{!cartItems.length && <div className="cart-empty"><strong>Seu carrinho está vazio</strong><p>Abra um produto e adicione-o para montar a solicitação.</p><button type="button" onClick={() => setCartOpen(false)}>Continuar navegando</button></div>}{cartItems.map((item) => <article className="cart-item" key={item.key}><a href={item.productUrl || productUrl({ slug: item.productSlug })} onClick={() => setCartOpen(false)}><ThemeImageView image={item.image} fallbackAlt={item.title} /></a><div><strong>{item.title}</strong>{item.variantName && <small>{item.variantName}</small>}{item.sku && <small>Ref. {item.sku}</small>}<div className="cart-quantity"><button type="button" onClick={() => setCartItems((current) => current.flatMap((candidate) => candidate.key !== item.key ? [candidate] : candidate.quantity > 1 ? [{ ...candidate, quantity: candidate.quantity - 1 }] : []))}>−</button><span>{item.quantity}</span><button type="button" onClick={() => setCartItems((current) => current.map((candidate) => candidate.key === item.key ? { ...candidate, quantity: Math.min(99, candidate.quantity + 1) } : candidate))}>+</button><button type="button" className="cart-remove" onClick={() => setCartItems((current) => current.filter((candidate) => candidate.key !== item.key))}>Remover</button></div></div></article>)}</div>{cartItems.length > 0 && <footer className="cart-footer"><p>O valor e a disponibilidade serão confirmados pela loja.</p>{checkoutUrl ? <a className="button button-primary button-block" href={checkoutUrl} target="_blank" rel="noreferrer">Enviar orçamento pelo WhatsApp</a> : <p className="cart-warning">Configure o WhatsApp da loja para enviar o orçamento.</p>}</footer>}</aside></div>}</div></ThemeInteractionProvider>;
|
|
136
|
+
return <ThemeInteractionProvider onAddToCart={addToCart}><div className="store-shell nuvler-default-theme" data-theme-id={themeDefinition.manifest.id} data-theme-version={themeDefinition.manifest.version} style={style}><Header site={site} categories={context.navigation.categories} pages={context.navigation.pages} menu={context.navigation.menu} headerButton={context.navigation.headerButton} template={themeDefinition.template} searchProducts={adapters?.searchProducts} cart={cartButton} /><div className={`store-page${isNotFound ? " store-page-not-found" : ""}`}>{content}</div>{!isNotFound && <Footer site={site} pages={context.navigation.pages} template={themeDefinition.template} />}{cartOpen && <div className="cart-backdrop" role="presentation" onPointerDown={(event) => event.target === event.currentTarget && setCartOpen(false)}><aside className="cart-drawer" aria-label="Carrinho de orçamento"><div className="cart-heading"><div><small>Seu orçamento</small><strong>{cartCount} {cartCount === 1 ? "item" : "itens"}</strong></div><button type="button" onClick={() => setCartOpen(false)} aria-label="Fechar carrinho">×</button></div><div className="cart-items">{!cartItems.length && <div className="cart-empty"><strong>Seu carrinho está vazio</strong><p>Abra um produto e adicione-o para montar a solicitação.</p><button type="button" onClick={() => setCartOpen(false)}>Continuar navegando</button></div>}{cartItems.map((item) => <article className="cart-item" key={item.key}><a href={item.productUrl || productUrl({ slug: item.productSlug })} onClick={() => setCartOpen(false)}><ThemeImageView image={item.image} fallbackAlt={item.title} /></a><div><strong>{item.title}</strong>{item.variantName && <small>{item.variantName}</small>}{item.sku && <small>Ref. {item.sku}</small>}{showPrices && typeof item.unitPrice === "number" && <b>{money(item.unitPrice)}</b>}<div className="cart-quantity"><button type="button" onClick={() => setCartItems((current) => current.flatMap((candidate) => candidate.key !== item.key ? [candidate] : candidate.quantity > 1 ? [{ ...candidate, quantity: candidate.quantity - 1 }] : []))}>−</button><span>{item.quantity}</span><button type="button" onClick={() => setCartItems((current) => current.map((candidate) => candidate.key === item.key ? { ...candidate, quantity: Math.min(99, candidate.quantity + 1) } : candidate))}>+</button><button type="button" className="cart-remove" onClick={() => setCartItems((current) => current.filter((candidate) => candidate.key !== item.key))}>Remover</button></div></div></article>)}</div>{cartItems.length > 0 && <footer className="cart-footer">{showPrices && hasCompletePrices && <div><span>Total estimado</span><strong>{money(cartTotal)}</strong></div>}<p>O valor e a disponibilidade serão confirmados pela loja.</p>{checkoutUrl ? <a className="button button-primary button-block" href={checkoutUrl} target="_blank" rel="noreferrer">Enviar orçamento pelo WhatsApp</a> : <p className="cart-warning">Configure o WhatsApp da loja para enviar o orçamento.</p>}</footer>}</aside></div>}</div></ThemeInteractionProvider>;
|
|
123
137
|
}
|
|
124
138
|
|
|
125
139
|
Theme.displayName = `NuvlerThemeRuntime(${themeDefinition.manifest.id})`;
|
|
@@ -1769,6 +1769,74 @@ select {
|
|
|
1769
1769
|
line-height: 1.65;
|
|
1770
1770
|
}
|
|
1771
1771
|
|
|
1772
|
+
.mini-banners-section {
|
|
1773
|
+
padding-block: 36px;
|
|
1774
|
+
}
|
|
1775
|
+
|
|
1776
|
+
.mini-banners-grid {
|
|
1777
|
+
display: grid;
|
|
1778
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
1779
|
+
gap: clamp(16px, 2vw, 28px);
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1782
|
+
.mini-banners-grid[data-layout="3x1"] {
|
|
1783
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1786
|
+
.mini-banner-card {
|
|
1787
|
+
display: grid;
|
|
1788
|
+
align-content: start;
|
|
1789
|
+
min-width: 0;
|
|
1790
|
+
color: var(--store-text);
|
|
1791
|
+
}
|
|
1792
|
+
|
|
1793
|
+
.mini-banner-image {
|
|
1794
|
+
display: block;
|
|
1795
|
+
aspect-ratio: 16 / 9;
|
|
1796
|
+
border-radius: var(--border-radius);
|
|
1797
|
+
overflow: hidden;
|
|
1798
|
+
background: var(--store-surface-alt);
|
|
1799
|
+
}
|
|
1800
|
+
|
|
1801
|
+
.mini-banner-image > img,
|
|
1802
|
+
.mini-banner-image > .store-image-placeholder {
|
|
1803
|
+
width: 100%;
|
|
1804
|
+
height: 100%;
|
|
1805
|
+
object-fit: cover;
|
|
1806
|
+
transition: transform 220ms ease;
|
|
1807
|
+
}
|
|
1808
|
+
|
|
1809
|
+
.mini-banner-card strong {
|
|
1810
|
+
margin-top: 12px;
|
|
1811
|
+
font-size: clamp(15px, 1.5vw, 19px);
|
|
1812
|
+
line-height: 1.3;
|
|
1813
|
+
}
|
|
1814
|
+
|
|
1815
|
+
.mini-banner-link-label {
|
|
1816
|
+
display: inline-flex;
|
|
1817
|
+
align-items: center;
|
|
1818
|
+
width: fit-content;
|
|
1819
|
+
margin-top: 8px;
|
|
1820
|
+
color: var(--color-primary);
|
|
1821
|
+
font-size: 14px;
|
|
1822
|
+
font-weight: 800;
|
|
1823
|
+
}
|
|
1824
|
+
|
|
1825
|
+
.mini-banner-link-label::after {
|
|
1826
|
+
content: "→";
|
|
1827
|
+
margin-left: 6px;
|
|
1828
|
+
}
|
|
1829
|
+
|
|
1830
|
+
a.mini-banner-card:hover .mini-banner-image > img {
|
|
1831
|
+
transform: scale(1.025);
|
|
1832
|
+
}
|
|
1833
|
+
|
|
1834
|
+
a.mini-banner-card:focus-visible {
|
|
1835
|
+
outline: 3px solid var(--color-primary);
|
|
1836
|
+
outline-offset: 5px;
|
|
1837
|
+
border-radius: var(--border-radius);
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1772
1840
|
.banner-copy .button {
|
|
1773
1841
|
margin-top: 28px;
|
|
1774
1842
|
}
|
|
@@ -2152,16 +2220,18 @@ select {
|
|
|
2152
2220
|
|
|
2153
2221
|
.image-text-media {
|
|
2154
2222
|
overflow: hidden;
|
|
2155
|
-
aspect-ratio: 4 / 3;
|
|
2156
2223
|
border-radius: var(--radius-md);
|
|
2157
|
-
background: #eef0ea;
|
|
2158
2224
|
}
|
|
2159
2225
|
|
|
2160
|
-
.image-text-media img
|
|
2226
|
+
.image-text-media img {
|
|
2227
|
+
display: block;
|
|
2228
|
+
width: 100%;
|
|
2229
|
+
height: auto;
|
|
2230
|
+
}
|
|
2231
|
+
|
|
2161
2232
|
.image-text-media .store-image-placeholder {
|
|
2233
|
+
min-height: 320px;
|
|
2162
2234
|
width: 100%;
|
|
2163
|
-
height: 100%;
|
|
2164
|
-
object-fit: cover;
|
|
2165
2235
|
}
|
|
2166
2236
|
|
|
2167
2237
|
.image-text-copy > span {
|
|
@@ -2580,6 +2650,7 @@ select {
|
|
|
2580
2650
|
color: var(--store-muted);
|
|
2581
2651
|
font-size: 12px;
|
|
2582
2652
|
line-height: 1.2;
|
|
2653
|
+
text-decoration: line-through;
|
|
2583
2654
|
}
|
|
2584
2655
|
|
|
2585
2656
|
.product-card-price strong {
|
|
@@ -2791,6 +2862,94 @@ select {
|
|
|
2791
2862
|
gap: var(--space-3);
|
|
2792
2863
|
}
|
|
2793
2864
|
|
|
2865
|
+
.home-brands-grid[data-columns="1"] {
|
|
2866
|
+
grid-template-columns: repeat(1, minmax(0, 1fr));
|
|
2867
|
+
}
|
|
2868
|
+
|
|
2869
|
+
.home-brands-grid[data-columns="2"] {
|
|
2870
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
2871
|
+
}
|
|
2872
|
+
|
|
2873
|
+
.home-brands-grid[data-columns="3"] {
|
|
2874
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
2875
|
+
}
|
|
2876
|
+
|
|
2877
|
+
.home-brands-grid[data-columns="4"] {
|
|
2878
|
+
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
2879
|
+
}
|
|
2880
|
+
|
|
2881
|
+
.home-brands-grid[data-columns="5"] {
|
|
2882
|
+
grid-template-columns: repeat(5, minmax(0, 1fr));
|
|
2883
|
+
}
|
|
2884
|
+
|
|
2885
|
+
.home-brands-grid[data-columns="6"] {
|
|
2886
|
+
grid-template-columns: repeat(6, minmax(0, 1fr));
|
|
2887
|
+
}
|
|
2888
|
+
|
|
2889
|
+
.brands-carousel {
|
|
2890
|
+
position: relative;
|
|
2891
|
+
padding-top: 46px;
|
|
2892
|
+
}
|
|
2893
|
+
|
|
2894
|
+
.brands-carousel-track {
|
|
2895
|
+
display: flex;
|
|
2896
|
+
align-items: stretch;
|
|
2897
|
+
gap: var(--space-3);
|
|
2898
|
+
overflow-x: auto;
|
|
2899
|
+
padding: 4px 0 22px;
|
|
2900
|
+
scroll-behavior: smooth;
|
|
2901
|
+
scroll-snap-type: x mandatory;
|
|
2902
|
+
scrollbar-width: none;
|
|
2903
|
+
}
|
|
2904
|
+
|
|
2905
|
+
.brands-carousel-track::-webkit-scrollbar {
|
|
2906
|
+
display: none;
|
|
2907
|
+
}
|
|
2908
|
+
|
|
2909
|
+
.brands-carousel-track > article,
|
|
2910
|
+
.brands-carousel-track > a {
|
|
2911
|
+
display: grid;
|
|
2912
|
+
min-width: 160px;
|
|
2913
|
+
min-height: 104px;
|
|
2914
|
+
flex: 0 0 calc((100% - 48px) / 5);
|
|
2915
|
+
place-items: center;
|
|
2916
|
+
overflow: hidden;
|
|
2917
|
+
border: 1px solid var(--store-line);
|
|
2918
|
+
border-radius: var(--radius-md);
|
|
2919
|
+
background: var(--store-surface);
|
|
2920
|
+
padding: var(--space-4);
|
|
2921
|
+
scroll-snap-align: start;
|
|
2922
|
+
text-align: center;
|
|
2923
|
+
}
|
|
2924
|
+
|
|
2925
|
+
.brands-carousel-track img {
|
|
2926
|
+
width: 100%;
|
|
2927
|
+
max-width: 150px;
|
|
2928
|
+
max-height: 54px;
|
|
2929
|
+
object-fit: contain;
|
|
2930
|
+
}
|
|
2931
|
+
|
|
2932
|
+
.brands-carousel-track strong {
|
|
2933
|
+
font-size: 14px;
|
|
2934
|
+
}
|
|
2935
|
+
|
|
2936
|
+
.brands-carousel .carousel-arrow {
|
|
2937
|
+
top: 0;
|
|
2938
|
+
width: 34px;
|
|
2939
|
+
height: 34px;
|
|
2940
|
+
transform: none;
|
|
2941
|
+
background: var(--store-surface);
|
|
2942
|
+
}
|
|
2943
|
+
|
|
2944
|
+
.brands-carousel .carousel-arrow-prev {
|
|
2945
|
+
right: 42px;
|
|
2946
|
+
left: auto;
|
|
2947
|
+
}
|
|
2948
|
+
|
|
2949
|
+
.brands-carousel .carousel-arrow-next {
|
|
2950
|
+
right: 0;
|
|
2951
|
+
}
|
|
2952
|
+
|
|
2794
2953
|
.home-brands-grid > article,
|
|
2795
2954
|
.home-brands-grid > a {
|
|
2796
2955
|
display: grid;
|
|
@@ -4198,6 +4357,11 @@ select {
|
|
|
4198
4357
|
}
|
|
4199
4358
|
|
|
4200
4359
|
@media (max-width: 800px) {
|
|
4360
|
+
.mini-banners-grid,
|
|
4361
|
+
.mini-banners-grid[data-layout="3x1"] {
|
|
4362
|
+
grid-template-columns: 1fr;
|
|
4363
|
+
}
|
|
4364
|
+
|
|
4201
4365
|
.store-container {
|
|
4202
4366
|
width: min(calc(100% - 28px), var(--container-width));
|
|
4203
4367
|
}
|
|
@@ -4439,10 +4603,27 @@ select {
|
|
|
4439
4603
|
grid-template-columns: 1fr;
|
|
4440
4604
|
}
|
|
4441
4605
|
|
|
4442
|
-
.home-brands-grid {
|
|
4606
|
+
.home-brands-grid[data-columns="1"] {
|
|
4607
|
+
grid-template-columns: repeat(1, minmax(0, 1fr));
|
|
4608
|
+
}
|
|
4609
|
+
|
|
4610
|
+
.home-brands-grid[data-columns="2"] {
|
|
4611
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
4612
|
+
}
|
|
4613
|
+
|
|
4614
|
+
.home-brands-grid[data-columns="3"],
|
|
4615
|
+
.home-brands-grid[data-columns="4"],
|
|
4616
|
+
.home-brands-grid[data-columns="5"],
|
|
4617
|
+
.home-brands-grid[data-columns="6"] {
|
|
4443
4618
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
4444
4619
|
}
|
|
4445
4620
|
|
|
4621
|
+
.brands-carousel-track > article,
|
|
4622
|
+
.brands-carousel-track > a {
|
|
4623
|
+
min-width: 0;
|
|
4624
|
+
flex-basis: calc((100% - 24px) / 3);
|
|
4625
|
+
}
|
|
4626
|
+
|
|
4446
4627
|
.benefits-grid > div + div {
|
|
4447
4628
|
border-top: 1px solid var(--store-line);
|
|
4448
4629
|
border-left: 0;
|
|
@@ -4640,10 +4821,23 @@ select {
|
|
|
4640
4821
|
font-size: 16px;
|
|
4641
4822
|
}
|
|
4642
4823
|
|
|
4643
|
-
.home-brands-grid {
|
|
4824
|
+
.home-brands-grid[data-columns="1"] {
|
|
4825
|
+
grid-template-columns: repeat(1, minmax(0, 1fr));
|
|
4826
|
+
}
|
|
4827
|
+
|
|
4828
|
+
.home-brands-grid[data-columns="2"],
|
|
4829
|
+
.home-brands-grid[data-columns="3"],
|
|
4830
|
+
.home-brands-grid[data-columns="4"],
|
|
4831
|
+
.home-brands-grid[data-columns="5"],
|
|
4832
|
+
.home-brands-grid[data-columns="6"] {
|
|
4644
4833
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
4645
4834
|
}
|
|
4646
4835
|
|
|
4836
|
+
.brands-carousel-track > article,
|
|
4837
|
+
.brands-carousel-track > a {
|
|
4838
|
+
flex-basis: calc((100% - 12px) / 2);
|
|
4839
|
+
}
|
|
4840
|
+
|
|
4647
4841
|
.benefits-section {
|
|
4648
4842
|
padding: 24px 0;
|
|
4649
4843
|
}
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@nuvler/theme-sdk": "^1.
|
|
16
|
+
"@nuvler/theme-sdk": "^1.4.3"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"react": "^19.0.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@nuvler/cli": "^0.5.
|
|
22
|
+
"@nuvler/cli": "^0.5.11",
|
|
23
23
|
"@types/react": "^19.0.0",
|
|
24
24
|
"react": "^19.0.0",
|
|
25
25
|
"typescript": "^5.9.0"
|
|
@@ -32,8 +32,8 @@ function Footer({ site }: FooterProps) {
|
|
|
32
32
|
return <footer className="theme-footer"><strong>{name}</strong><span>Tema __NUVLER_THEME_NAME__</span></footer>;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
function ProductGrid({ products }: ProductGridProps) {
|
|
36
|
-
return <div className="theme-products">{products.map((product) => <article key={product.slug}><a href={productUrl(product)}><strong>{product.title}</strong><span>{product.sku || "Ver produto"}</span></a></article>)}</div>;
|
|
35
|
+
function ProductGrid({ products, showPrices = true }: ProductGridProps) {
|
|
36
|
+
return <div className="theme-products">{products.map((product) => <article key={product.slug}><a href={productUrl(product)}><strong>{product.title}</strong><span>{showPrices && typeof (product.promotionalPrice ?? product.price) === "number" ? new Intl.NumberFormat("pt-BR", { style: "currency", currency: "BRL" }).format((product.promotionalPrice ?? product.price)!) : product.sku || "Ver produto"}</span></a></article>)}</div>;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
function bannerUrl(banner: ThemeHomeBanner, mobile = false): string {
|
|
@@ -51,12 +51,12 @@ function Home({ products, site, sections }: HomeProps) {
|
|
|
51
51
|
{(banner.title || banner.description || (banner.buttonLabel && banner.buttonUrl)) && <div className="theme-banner-content">{banner.title && <h2>{banner.title}</h2>}{banner.description && <p>{banner.description}</p>}{banner.buttonLabel && banner.buttonUrl && <a href={banner.buttonUrl}>{banner.buttonLabel}</a>}</div>}
|
|
52
52
|
</section>}
|
|
53
53
|
<section className="theme-hero"><span>__NUVLER_THEME_NAME__</span><h1>{name}</h1><p>{site.settings?.description || "Uma nova experiência de compra."}</p><a href="/produtos">Explorar produtos</a></section>
|
|
54
|
-
<section className="theme-section"><h2>Produtos em destaque</h2><ProductGrid products={products} /></section>
|
|
54
|
+
<section className="theme-section"><h2>Produtos em destaque</h2><ProductGrid products={products} showPrices={site.settings?.catalog?.showPrices ?? true} /></section>
|
|
55
55
|
</main>;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
function ProductDetail({ product, descriptionContent, onAddToCart }: ProductDetailProps) {
|
|
59
|
-
return <article className="theme-product-detail"><div><span>{product.categories[0]?.name || "Produto"}</span><h1>{product.title}</h1>{descriptionContent}</div><button type="button" onClick={() => onAddToCart?.({ productSlug: product.slug, productUrl: productUrl(product), title: product.title, sku: product.sku, image: product.image, unitPrice: product.promotionalPrice ?? product.price })}>Adicionar ao orçamento</button></article>;
|
|
58
|
+
function ProductDetail({ product, showPrices = true, descriptionContent, onAddToCart }: ProductDetailProps) {
|
|
59
|
+
return <article className="theme-product-detail"><div><span>{product.categories[0]?.name || "Produto"}</span><h1>{product.title}</h1>{showPrices && typeof (product.promotionalPrice ?? product.price) === "number" && <strong>{new Intl.NumberFormat("pt-BR", { style: "currency", currency: "BRL" }).format((product.promotionalPrice ?? product.price)!)}</strong>}{descriptionContent}</div><button type="button" onClick={() => onAddToCart?.({ productSlug: product.slug, productUrl: productUrl(product), title: product.title, sku: product.sku, image: product.image, unitPrice: showPrices ? product.promotionalPrice ?? product.price : null })}>Adicionar ao orçamento</button></article>;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
export const manifest = manifestData as ThemeManifest;
|
|
@@ -35,8 +35,8 @@ export default function Theme({ context, route = { type: "home" }, sdk }: Nuvler
|
|
|
35
35
|
|
|
36
36
|
let content;
|
|
37
37
|
if (route.type === "home") content = <Home sections={context.home.content.sections} products={context.catalog.products} posts={context.editorial.posts} services={context.editorial.services} cases={context.editorial.cases} site={site} template={themeDefinition.template} />;
|
|
38
|
-
else if (route.type === "catalog") content = <main className="theme-section"><h1>{route.search ? `Busca: ${route.search}` : "Produtos"}</h1><ProductGrid products={route.products} /></main>;
|
|
39
|
-
else if (route.type === "product") content = <main className="theme-section"><ProductDetail product={route.product} contact={site.settings?.contact} productUrl={null} descriptionContent={<p>{route.product.description}</p>} onAddToCart={sdk?.cart.add} /></main>;
|
|
38
|
+
else if (route.type === "catalog") content = <main className="theme-section"><h1>{route.search ? `Busca: ${route.search}` : "Produtos"}</h1><ProductGrid products={route.products} showPrices={site.settings?.catalog?.showPrices ?? true} /></main>;
|
|
39
|
+
else if (route.type === "product") content = <main className="theme-section"><ProductDetail product={route.product} showPrices={site.settings?.catalog?.showPrices ?? true} contact={site.settings?.contact} productUrl={null} descriptionContent={<p>{route.product.description}</p>} onAddToCart={sdk?.cart.add} /></main>;
|
|
40
40
|
else if (route.type === "editorial-list") content = <main className="theme-section"><h1>{route.title}</h1>{route.items.map((item) => <article key={item.slug}><h2>{item.title}</h2><p>{item.description}</p></article>)}</main>;
|
|
41
41
|
else if (route.type === "editorial-detail") content = <main className="theme-section"><h1>{route.item.title}</h1><p>{route.item.description}</p></main>;
|
|
42
42
|
else content = <main className="theme-section"><h1>{route.type === "loading" ? "Carregando…" : route.type === "page" ? route.title : "Conteúdo não encontrado"}</h1></main>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuvler/cli",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.11",
|
|
4
4
|
"description": "CLI oficial para criação, validação, preview e empacotamento de temas Nuvler",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@nuvler/theme-schema": "^1.
|
|
24
|
-
"@nuvler/theme-sdk": "^1.4.
|
|
23
|
+
"@nuvler/theme-schema": "^1.4.1",
|
|
24
|
+
"@nuvler/theme-sdk": "^1.4.3",
|
|
25
25
|
"@vitejs/plugin-react": "^6.0.5",
|
|
26
26
|
"commander": "^15.0.0",
|
|
27
27
|
"react": "19.2.8",
|