feat: posuvnik vodorovnej polohy cenovky v produkte (cenovka aj so stitkami predajni)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
66c098190d
commit
7a99b37b3f
3 files changed
+4
-2
No files matched your search
@@ -544,6 +544,7 @@ export const ProductEditor: React.FC<ProductEditorProps> = ({
|
||||
</div>
|
||||
|
||||
<Slider label="Veľkosť" value={badgeWidth} display={`${badgeWidth} px`} min={60} max={200} step={1} onChange={set('badgeWidth')} />
|
||||
<Slider label="Vodorovne" value={p.badgeOffsetX || 0} display={`${p.badgeOffsetX || 0}`} min={-150} max={8} step={1} onChange={set('badgeOffsetX')} />
|
||||
|
||||
{isLoyalty ? (
|
||||
<>
|
||||
|
||||
@@ -225,7 +225,7 @@ export function cardVisualKey(p: CardProduct, ctx: CardContext): string {
|
||||
'v2', // verzia vykreslenia – zvýšiť, keď sa zmení spôsob prípravy obrázkov (v2: písma z Adobe Fonts)
|
||||
ctx.variant, ctx.cardWidth, p.cardBgColor || ctx.cardBg, ctx.variant === 'standard' ? ctx.defaultBadge : null,
|
||||
p.imageUrl, p.imageScale ?? DEFAULT_IMAGE_SCALE, p.imageOffsetX || 0, p.imageOffsetY || 0,
|
||||
p.customBadgePngUrl, badgeWidthFor(p, ctx.variant),
|
||||
p.customBadgePngUrl, badgeWidthFor(p, ctx.variant), p.badgeOffsetX || 0,
|
||||
t ? [t.svgRaw, t.layersConfig, t.width] : null,
|
||||
p.priceMain, p.priceSub, p.discountText, p.badgeText, p.unitPrice,
|
||||
p.cardPriceMain, p.cardPriceSub, p.cardDiscount, p.cardUnitPrice, p.appPriceMain, p.appPriceSub, p.appDiscount, p.appUnitPrice,
|
||||
@@ -355,7 +355,7 @@ function renderVisualPreview(p: CardProduct, ctx: CardContext, key: string): str
|
||||
})
|
||||
.join('')}
|
||||
${(p.labels || []).map(renderLabel).join('')}
|
||||
<div style="position: absolute; right: 8px; bottom: 8px; width: ${bw}px;">
|
||||
<div style="position: absolute; right: ${8 - (p.badgeOffsetX || 0)}px; bottom: 8px; width: ${bw}px;">
|
||||
${stores ? `<div style="position: absolute; right: ${insetRight - sx}px; bottom: calc(100% - ${insetTop}px + ${sy}px);">${stores}</div>` : ''}
|
||||
${renderBadge(p, ctx, bw)}
|
||||
</div>
|
||||
|
||||
@@ -38,6 +38,7 @@ export interface ProductItem {
|
||||
badgeId?: string; // priradená cenovka z databázy
|
||||
badgeCustomTemplate?: BadgeTemplate; // Uložená dynamická šablóna cenovky (bez fixnej ceny)
|
||||
badgeWidth?: number; // Nastaviteľná šírka/veľkosť cenovky v px (napr. 70 až 180)
|
||||
badgeOffsetX?: number; // Posun celej cenovky (aj so štítkami predajní) vodorovne v px, + doprava
|
||||
badgeAlign?: 'left' | 'center' | 'right'; // Zarovnanie cenovky (vľavo, stred, vpravo)
|
||||
badgePaddingTop?: number; // Odsadenie zhora v px
|
||||
badgePaddingBottom?: number; // Odsadenie zdola v px
|
||||
|
||||
Reference in new issue
Block a user