@lit-roa/custom-footer 0.0.0-stage → 0.1.2
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 +148 -2
- package/dist/custom-footer.d.ts +86 -0
- package/dist/custom-footer.d.ts.map +1 -0
- package/dist/custom-footer.js +522 -0
- package/dist/custom-footer.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/package.json +28 -4
- package/src/custom-footer.ts +564 -0
- package/src/index.ts +10 -0
|
@@ -0,0 +1,564 @@
|
|
|
1
|
+
import { LitElement, css, html, nothing, type TemplateResult } from 'lit';
|
|
2
|
+
import { customElement, property, state } from 'lit/decorators.js';
|
|
3
|
+
import {
|
|
4
|
+
emitir,
|
|
5
|
+
estilosBase,
|
|
6
|
+
iconoBrandFacebook,
|
|
7
|
+
iconoBrandInstagram,
|
|
8
|
+
iconoBrandLinkedin,
|
|
9
|
+
iconoBrandPinterest,
|
|
10
|
+
iconoBrandTelegram,
|
|
11
|
+
iconoBrandTiktok,
|
|
12
|
+
iconoBrandWhatsapp,
|
|
13
|
+
iconoBrandX,
|
|
14
|
+
iconoBrandYoutube,
|
|
15
|
+
iconoChevronDown,
|
|
16
|
+
iconoClock,
|
|
17
|
+
iconoMail,
|
|
18
|
+
iconoMapPin,
|
|
19
|
+
iconoPhone,
|
|
20
|
+
tokens,
|
|
21
|
+
} from '@lit-roa/base';
|
|
22
|
+
|
|
23
|
+
export interface EnlaceFooter {
|
|
24
|
+
texto: string;
|
|
25
|
+
/** URL de referencia; viaja en el evento, el componente no navega. */
|
|
26
|
+
href?: string;
|
|
27
|
+
/** Identificador libre para que el sitio sepa qué hacer (ej. "terminos"). */
|
|
28
|
+
id?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface GrupoFooter {
|
|
32
|
+
titulo: string;
|
|
33
|
+
enlaces: EnlaceFooter[];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type RedSocial =
|
|
37
|
+
| 'facebook'
|
|
38
|
+
| 'instagram'
|
|
39
|
+
| 'tiktok'
|
|
40
|
+
| 'whatsapp'
|
|
41
|
+
| 'youtube'
|
|
42
|
+
| 'x'
|
|
43
|
+
| 'linkedin'
|
|
44
|
+
| 'pinterest'
|
|
45
|
+
| 'telegram';
|
|
46
|
+
|
|
47
|
+
export interface RedFooter {
|
|
48
|
+
red: RedSocial;
|
|
49
|
+
url: string;
|
|
50
|
+
/** Texto accesible; por omisión el nombre de la red. */
|
|
51
|
+
etiqueta?: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface ContactoFooter {
|
|
55
|
+
direccion?: string;
|
|
56
|
+
telefono?: string;
|
|
57
|
+
correo?: string;
|
|
58
|
+
horario?: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export type MetodoPago = 'visa' | 'mastercard' | 'amex' | 'mercado-pago';
|
|
62
|
+
|
|
63
|
+
export interface DetalleClicEnlace {
|
|
64
|
+
enlace: EnlaceFooter;
|
|
65
|
+
/** Título del grupo; `undefined` cuando es el logo. */
|
|
66
|
+
grupo?: string;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const iconosRedes: Record<RedSocial, { icono: TemplateResult; nombre: string }> = {
|
|
70
|
+
facebook: { icono: iconoBrandFacebook, nombre: 'Facebook' },
|
|
71
|
+
instagram: { icono: iconoBrandInstagram, nombre: 'Instagram' },
|
|
72
|
+
tiktok: { icono: iconoBrandTiktok, nombre: 'TikTok' },
|
|
73
|
+
whatsapp: { icono: iconoBrandWhatsapp, nombre: 'WhatsApp' },
|
|
74
|
+
youtube: { icono: iconoBrandYoutube, nombre: 'YouTube' },
|
|
75
|
+
x: { icono: iconoBrandX, nombre: 'X' },
|
|
76
|
+
linkedin: { icono: iconoBrandLinkedin, nombre: 'LinkedIn' },
|
|
77
|
+
pinterest: { icono: iconoBrandPinterest, nombre: 'Pinterest' },
|
|
78
|
+
telegram: { icono: iconoBrandTelegram, nombre: 'Telegram' },
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
// TODO: cambiar por el SVG oficial del kit de marca de Mercado Pago.
|
|
82
|
+
const logoMercadoPago = html`<svg width="30" height="21" viewBox="0 0 30 21" aria-hidden="true"><ellipse cx="15" cy="10.5" rx="14" ry="9.5" fill="#00b1ea" stroke="#0a0a6b" stroke-width="1.4"/><path d="M4.5 9.5c2-1.6 4-2.2 6-1.4l3 1.2c1.2.5 2.2.3 3-.4l1.6-1.3c1.6-1 3.6-.9 5.5.2l2 1.4" fill="none" stroke="#0a0a6b" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/><path d="M8 12.2l2.2 1.8c.6.5 1.4.5 1.9 0M10.6 11.4l2.4 2c.6.5 1.4.5 1.9 0M13.2 10.6l2.5 2c.6.5 1.4.4 1.8-.1l.3-.4M20.5 10.5l-2.8 1" fill="none" stroke="#0a0a6b" stroke-width="1.3" stroke-linecap="round"/></svg>`;
|
|
83
|
+
|
|
84
|
+
const metodosPago: Record<MetodoPago, { nombre: string; contenido: TemplateResult }> = {
|
|
85
|
+
visa: { nombre: 'Visa', contenido: html`VISA` },
|
|
86
|
+
mastercard: { nombre: 'Mastercard', contenido: html`<i></i><i></i>` },
|
|
87
|
+
amex: { nombre: 'American Express', contenido: html`AMEX` },
|
|
88
|
+
'mercado-pago': { nombre: 'Mercado Pago', contenido: html`${logoMercadoPago}<span>mercado<br />pago</span>` },
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/** Ancho (px) por debajo del cual el footer pasa a una columna con acordeones. */
|
|
92
|
+
const ANCHO_ESTRECHO = 640;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Footer genérico y responsive.
|
|
96
|
+
*
|
|
97
|
+
* Los enlaces no navegan: lanzan `clic-enlace` para que el sitio decida si
|
|
98
|
+
* cambia de ruta o abre una modal. Ctrl/Cmd + clic sí abre el `href` en otra
|
|
99
|
+
* pestaña. Las redes sociales sí son ligas normales (se abren en otra pestaña).
|
|
100
|
+
*
|
|
101
|
+
* @fires clic-enlace - Al tocar un enlace o el logo. `detail`: `{ enlace, grupo }`.
|
|
102
|
+
* @slot boletin - Franja superior, por ejemplo un formulario de novedades.
|
|
103
|
+
* @slot extra - Al final de la columna de contacto, por ejemplo horarios especiales.
|
|
104
|
+
* @slot pie - En la barra inferior, junto al ©.
|
|
105
|
+
*/
|
|
106
|
+
@customElement('lr-custom-footer')
|
|
107
|
+
export class LrCustomFooter extends LitElement {
|
|
108
|
+
static override styles = [
|
|
109
|
+
tokens,
|
|
110
|
+
estilosBase,
|
|
111
|
+
css`
|
|
112
|
+
:host {
|
|
113
|
+
display: block;
|
|
114
|
+
--_f-fondo: var(--lr-footer-fondo, #1c1917);
|
|
115
|
+
--_f-fondo-alterno: var(--lr-footer-fondo-alterno, rgb(255 255 255 / 0.04));
|
|
116
|
+
--_f-texto: var(--lr-footer-texto, #e7e5e4);
|
|
117
|
+
--_f-titulos: var(--lr-footer-titulos, #ffffff);
|
|
118
|
+
--_f-texto-suave: var(--lr-footer-texto-suave, #a8a29e);
|
|
119
|
+
--_f-borde: var(--lr-footer-borde, #3a3431);
|
|
120
|
+
--_f-ancho: var(--lr-footer-ancho-maximo, 1160px);
|
|
121
|
+
}
|
|
122
|
+
footer {
|
|
123
|
+
background: var(--_f-fondo);
|
|
124
|
+
color: var(--_f-texto);
|
|
125
|
+
font-size: 0.875rem;
|
|
126
|
+
}
|
|
127
|
+
.cont {
|
|
128
|
+
max-width: var(--_f-ancho);
|
|
129
|
+
margin: 0 auto;
|
|
130
|
+
padding: 3rem 2rem 0;
|
|
131
|
+
}
|
|
132
|
+
a {
|
|
133
|
+
color: inherit;
|
|
134
|
+
}
|
|
135
|
+
a:focus-visible,
|
|
136
|
+
button:focus-visible {
|
|
137
|
+
outline: 2px solid var(--_color-primario);
|
|
138
|
+
outline-offset: 2px;
|
|
139
|
+
border-radius: 4px;
|
|
140
|
+
}
|
|
141
|
+
svg {
|
|
142
|
+
flex: none;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.boletin {
|
|
146
|
+
margin-bottom: 2.75rem;
|
|
147
|
+
}
|
|
148
|
+
.boletin[hidden] {
|
|
149
|
+
display: none;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.rejilla {
|
|
153
|
+
display: grid;
|
|
154
|
+
grid-template-columns: 1.5fr repeat(var(--_grupos, 3), 1fr) 1.3fr;
|
|
155
|
+
gap: 2rem;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.logo {
|
|
159
|
+
display: inline-flex;
|
|
160
|
+
align-items: center;
|
|
161
|
+
gap: 0.625rem;
|
|
162
|
+
font-size: 1.375rem;
|
|
163
|
+
font-weight: 600;
|
|
164
|
+
color: var(--_f-titulos);
|
|
165
|
+
text-decoration: none;
|
|
166
|
+
}
|
|
167
|
+
.logo img {
|
|
168
|
+
display: block;
|
|
169
|
+
max-height: var(--lr-footer-alto-logo, 44px);
|
|
170
|
+
max-width: 200px;
|
|
171
|
+
object-fit: contain;
|
|
172
|
+
}
|
|
173
|
+
.descripcion {
|
|
174
|
+
color: var(--_f-texto-suave);
|
|
175
|
+
line-height: 1.6;
|
|
176
|
+
margin: 1rem 0 1.25rem;
|
|
177
|
+
max-width: 300px;
|
|
178
|
+
}
|
|
179
|
+
.redes {
|
|
180
|
+
display: flex;
|
|
181
|
+
flex-wrap: wrap;
|
|
182
|
+
gap: 0.5rem;
|
|
183
|
+
margin: 0;
|
|
184
|
+
padding: 0;
|
|
185
|
+
list-style: none;
|
|
186
|
+
}
|
|
187
|
+
.redes a {
|
|
188
|
+
display: grid;
|
|
189
|
+
place-items: center;
|
|
190
|
+
width: 38px;
|
|
191
|
+
height: 38px;
|
|
192
|
+
border-radius: 999px;
|
|
193
|
+
border: 1px solid var(--_f-borde);
|
|
194
|
+
font-size: 1.25rem;
|
|
195
|
+
transition: background 0.15s, border-color 0.15s;
|
|
196
|
+
}
|
|
197
|
+
.redes a:hover {
|
|
198
|
+
background: var(--_color-primario);
|
|
199
|
+
border-color: var(--_color-primario);
|
|
200
|
+
color: var(--_color-sobre-primario);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.titulo {
|
|
204
|
+
margin: 0 0 0.875rem;
|
|
205
|
+
font-size: 0.9375rem;
|
|
206
|
+
font-weight: 600;
|
|
207
|
+
color: var(--_f-titulos);
|
|
208
|
+
}
|
|
209
|
+
.titulo button {
|
|
210
|
+
all: unset;
|
|
211
|
+
box-sizing: border-box;
|
|
212
|
+
display: flex;
|
|
213
|
+
width: 100%;
|
|
214
|
+
justify-content: space-between;
|
|
215
|
+
align-items: center;
|
|
216
|
+
padding: 1rem 0.125rem;
|
|
217
|
+
cursor: pointer;
|
|
218
|
+
}
|
|
219
|
+
.titulo button svg {
|
|
220
|
+
color: var(--_f-texto-suave);
|
|
221
|
+
font-size: 1.125rem;
|
|
222
|
+
transition: transform 0.2s;
|
|
223
|
+
}
|
|
224
|
+
.titulo button[aria-expanded='true'] svg {
|
|
225
|
+
transform: rotate(180deg);
|
|
226
|
+
}
|
|
227
|
+
.enlaces {
|
|
228
|
+
list-style: none;
|
|
229
|
+
margin: 0;
|
|
230
|
+
padding: 0;
|
|
231
|
+
display: grid;
|
|
232
|
+
gap: 0.625rem;
|
|
233
|
+
}
|
|
234
|
+
.enlaces a {
|
|
235
|
+
color: var(--_f-texto-suave);
|
|
236
|
+
text-decoration: none;
|
|
237
|
+
}
|
|
238
|
+
.enlaces a:hover {
|
|
239
|
+
color: var(--_f-texto);
|
|
240
|
+
text-decoration: underline;
|
|
241
|
+
text-underline-offset: 3px;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.dato {
|
|
245
|
+
display: flex;
|
|
246
|
+
gap: 0.625rem;
|
|
247
|
+
color: var(--_f-texto-suave);
|
|
248
|
+
margin: 0 0 0.75rem;
|
|
249
|
+
line-height: 1.45;
|
|
250
|
+
font-style: normal;
|
|
251
|
+
}
|
|
252
|
+
.dato svg {
|
|
253
|
+
color: var(--_color-primario);
|
|
254
|
+
font-size: 1.125rem;
|
|
255
|
+
margin-top: 1px;
|
|
256
|
+
}
|
|
257
|
+
.dato a {
|
|
258
|
+
text-decoration: none;
|
|
259
|
+
}
|
|
260
|
+
.dato a:hover {
|
|
261
|
+
text-decoration: underline;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.pie {
|
|
265
|
+
display: flex;
|
|
266
|
+
justify-content: space-between;
|
|
267
|
+
align-items: center;
|
|
268
|
+
flex-wrap: wrap;
|
|
269
|
+
gap: 1rem;
|
|
270
|
+
border-top: 1px solid var(--_f-borde);
|
|
271
|
+
margin-top: 2.75rem;
|
|
272
|
+
padding: 1.375rem 0 1.625rem;
|
|
273
|
+
color: var(--_f-texto-suave);
|
|
274
|
+
font-size: 0.8125rem;
|
|
275
|
+
}
|
|
276
|
+
.derechos {
|
|
277
|
+
display: flex;
|
|
278
|
+
flex-wrap: wrap;
|
|
279
|
+
gap: 0.5rem 1rem;
|
|
280
|
+
align-items: center;
|
|
281
|
+
}
|
|
282
|
+
.pagos {
|
|
283
|
+
display: flex;
|
|
284
|
+
gap: 0.375rem;
|
|
285
|
+
flex-wrap: wrap;
|
|
286
|
+
margin: 0;
|
|
287
|
+
padding: 0;
|
|
288
|
+
list-style: none;
|
|
289
|
+
}
|
|
290
|
+
.pago {
|
|
291
|
+
height: 26px;
|
|
292
|
+
min-width: 44px;
|
|
293
|
+
padding: 0 0.5rem;
|
|
294
|
+
border-radius: 5px;
|
|
295
|
+
background: #fff;
|
|
296
|
+
display: inline-flex;
|
|
297
|
+
align-items: center;
|
|
298
|
+
justify-content: center;
|
|
299
|
+
font-weight: 800;
|
|
300
|
+
font-size: 0.6875rem;
|
|
301
|
+
}
|
|
302
|
+
.pago.visa {
|
|
303
|
+
color: #1a1f71;
|
|
304
|
+
font-style: italic;
|
|
305
|
+
font-size: 0.8125rem;
|
|
306
|
+
}
|
|
307
|
+
.pago.amex {
|
|
308
|
+
background: #2e77bc;
|
|
309
|
+
color: #fff;
|
|
310
|
+
}
|
|
311
|
+
.pago.mastercard i {
|
|
312
|
+
width: 15px;
|
|
313
|
+
height: 15px;
|
|
314
|
+
border-radius: 50%;
|
|
315
|
+
background: #eb001b;
|
|
316
|
+
}
|
|
317
|
+
.pago.mastercard i + i {
|
|
318
|
+
background: #f79e1b;
|
|
319
|
+
margin-left: -6px;
|
|
320
|
+
opacity: 0.9;
|
|
321
|
+
}
|
|
322
|
+
.pago.mercado-pago {
|
|
323
|
+
gap: 5px;
|
|
324
|
+
padding: 0 7px 0 5px;
|
|
325
|
+
color: #0a0a6b;
|
|
326
|
+
font-weight: 700;
|
|
327
|
+
font-size: 8.5px;
|
|
328
|
+
line-height: 1;
|
|
329
|
+
text-align: left;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/* Celular o contenedor angosto */
|
|
333
|
+
.estrecho .cont {
|
|
334
|
+
padding: 2rem 1rem 0;
|
|
335
|
+
}
|
|
336
|
+
.estrecho .boletin {
|
|
337
|
+
margin-bottom: 1.75rem;
|
|
338
|
+
}
|
|
339
|
+
.estrecho .rejilla {
|
|
340
|
+
grid-template-columns: 1fr;
|
|
341
|
+
gap: 0;
|
|
342
|
+
}
|
|
343
|
+
.estrecho .marca {
|
|
344
|
+
text-align: center;
|
|
345
|
+
padding-bottom: 1.5rem;
|
|
346
|
+
}
|
|
347
|
+
.estrecho .descripcion {
|
|
348
|
+
margin: 0.875rem auto 1.125rem;
|
|
349
|
+
}
|
|
350
|
+
.estrecho .redes {
|
|
351
|
+
justify-content: center;
|
|
352
|
+
}
|
|
353
|
+
.estrecho .grupo {
|
|
354
|
+
border-top: 1px solid var(--_f-borde);
|
|
355
|
+
}
|
|
356
|
+
.estrecho .grupo .titulo {
|
|
357
|
+
margin: 0;
|
|
358
|
+
}
|
|
359
|
+
.estrecho .enlaces {
|
|
360
|
+
padding: 0 0.125rem 1rem;
|
|
361
|
+
}
|
|
362
|
+
.estrecho .enlaces[hidden] {
|
|
363
|
+
display: none;
|
|
364
|
+
}
|
|
365
|
+
.estrecho .contacto {
|
|
366
|
+
border-top: 1px solid var(--_f-borde);
|
|
367
|
+
padding-top: 1.25rem;
|
|
368
|
+
}
|
|
369
|
+
.estrecho .pie {
|
|
370
|
+
flex-direction: column;
|
|
371
|
+
text-align: center;
|
|
372
|
+
margin-top: 1.5rem;
|
|
373
|
+
}
|
|
374
|
+
.estrecho .derechos,
|
|
375
|
+
.estrecho .pagos {
|
|
376
|
+
justify-content: center;
|
|
377
|
+
}
|
|
378
|
+
`,
|
|
379
|
+
];
|
|
380
|
+
|
|
381
|
+
/** Nombre del negocio: se usa en el © y como texto del logo si no hay imagen. */
|
|
382
|
+
@property() nombre = '';
|
|
383
|
+
|
|
384
|
+
/** URL de la imagen del logo. */
|
|
385
|
+
@property() logo = '';
|
|
386
|
+
|
|
387
|
+
@property({ attribute: 'logo-alt' }) logoAlt = '';
|
|
388
|
+
|
|
389
|
+
/** `href` que viaja en `clic-enlace` al tocar el logo (con `id: "inicio"`). */
|
|
390
|
+
@property({ attribute: 'logo-href' }) logoHref = '/';
|
|
391
|
+
|
|
392
|
+
@property() descripcion = '';
|
|
393
|
+
|
|
394
|
+
/** Grupos de enlaces. Como atributo, en JSON. */
|
|
395
|
+
@property({ type: Array }) grupos: GrupoFooter[] = [];
|
|
396
|
+
|
|
397
|
+
/** Redes sociales. Como atributo, en JSON. */
|
|
398
|
+
@property({ type: Array }) redes: RedFooter[] = [];
|
|
399
|
+
|
|
400
|
+
/** Datos de contacto. Como atributo, en JSON. */
|
|
401
|
+
@property({ type: Object }) contacto: ContactoFooter = {};
|
|
402
|
+
|
|
403
|
+
/** Logos de pago a mostrar, en orden. Como atributo, en JSON. */
|
|
404
|
+
@property({ type: Array, attribute: 'metodos-pago' }) metodosPago: MetodoPago[] = [];
|
|
405
|
+
|
|
406
|
+
/** Título de la columna de contacto. */
|
|
407
|
+
@property({ attribute: 'titulo-contacto' }) tituloContacto = 'Contacto';
|
|
408
|
+
|
|
409
|
+
/** Reemplaza el texto después de "© año". */
|
|
410
|
+
@property({ attribute: 'texto-derechos' }) textoDerechos = '';
|
|
411
|
+
|
|
412
|
+
@state() private estrecho = false;
|
|
413
|
+
@state() private abiertos = new Set<number>();
|
|
414
|
+
@state() private conBoletin = false;
|
|
415
|
+
|
|
416
|
+
private observador?: ResizeObserver;
|
|
417
|
+
|
|
418
|
+
override connectedCallback() {
|
|
419
|
+
super.connectedCallback();
|
|
420
|
+
this.observador = new ResizeObserver(([entrada]) => {
|
|
421
|
+
this.estrecho = entrada.contentRect.width < ANCHO_ESTRECHO;
|
|
422
|
+
});
|
|
423
|
+
this.observador.observe(this);
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
override disconnectedCallback() {
|
|
427
|
+
super.disconnectedCallback();
|
|
428
|
+
this.observador?.disconnect();
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
override render() {
|
|
432
|
+
const { direccion, telefono, correo, horario } = this.contacto;
|
|
433
|
+
const conContacto = Boolean(direccion || telefono || correo || horario);
|
|
434
|
+
const derechos = this.textoDerechos || `${this.nombre}. Todos los derechos reservados.`;
|
|
435
|
+
|
|
436
|
+
return html`
|
|
437
|
+
<footer class=${this.estrecho ? 'estrecho' : ''}>
|
|
438
|
+
<div class="cont">
|
|
439
|
+
<div class="boletin" ?hidden=${!this.conBoletin}>
|
|
440
|
+
<slot name="boletin" @slotchange=${this.revisarBoletin}></slot>
|
|
441
|
+
</div>
|
|
442
|
+
|
|
443
|
+
<div class="rejilla" style="--_grupos: ${this.grupos.length}">
|
|
444
|
+
<div class="marca">
|
|
445
|
+
${this.renderLogo()}
|
|
446
|
+
${this.descripcion ? html`<p class="descripcion">${this.descripcion}</p>` : nothing}
|
|
447
|
+
${this.redes.length
|
|
448
|
+
? html`<ul class="redes">
|
|
449
|
+
${this.redes.map((r) => this.renderRed(r))}
|
|
450
|
+
</ul>`
|
|
451
|
+
: nothing}
|
|
452
|
+
</div>
|
|
453
|
+
|
|
454
|
+
${this.grupos.map((g, i) => this.renderGrupo(g, i))}
|
|
455
|
+
|
|
456
|
+
<div class="contacto">
|
|
457
|
+
${conContacto ? html`<h2 class="titulo">${this.tituloContacto}</h2>` : nothing}
|
|
458
|
+
<address>
|
|
459
|
+
${direccion ? html`<p class="dato">${iconoMapPin}<span>${direccion}</span></p>` : nothing}
|
|
460
|
+
${telefono
|
|
461
|
+
? html`<p class="dato">
|
|
462
|
+
${iconoPhone}<a href="tel:${telefono.replace(/[^\d+]/g, '')}">${telefono}</a>
|
|
463
|
+
</p>`
|
|
464
|
+
: nothing}
|
|
465
|
+
${correo ? html`<p class="dato">${iconoMail}<a href="mailto:${correo}">${correo}</a></p>` : nothing}
|
|
466
|
+
${horario ? html`<p class="dato">${iconoClock}<span>${horario}</span></p>` : nothing}
|
|
467
|
+
</address>
|
|
468
|
+
<slot name="extra"></slot>
|
|
469
|
+
</div>
|
|
470
|
+
</div>
|
|
471
|
+
|
|
472
|
+
<div class="pie">
|
|
473
|
+
<div class="derechos">
|
|
474
|
+
<span>© ${new Date().getFullYear()} ${derechos}</span>
|
|
475
|
+
<slot name="pie"></slot>
|
|
476
|
+
</div>
|
|
477
|
+
${this.metodosPago.length
|
|
478
|
+
? html`<ul class="pagos" aria-label="Métodos de pago">
|
|
479
|
+
${this.metodosPago.map((m) => this.renderPago(m))}
|
|
480
|
+
</ul>`
|
|
481
|
+
: nothing}
|
|
482
|
+
</div>
|
|
483
|
+
</div>
|
|
484
|
+
</footer>
|
|
485
|
+
`;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
private renderLogo() {
|
|
489
|
+
if (!this.logo && !this.nombre) return nothing;
|
|
490
|
+
const contenido = this.logo
|
|
491
|
+
? html`<img src=${this.logo} alt=${this.logoAlt || this.nombre} />`
|
|
492
|
+
: html`<span>${this.nombre}</span>`;
|
|
493
|
+
const enlace: EnlaceFooter = { texto: this.nombre, href: this.logoHref, id: 'inicio' };
|
|
494
|
+
return html`<a class="logo" href=${this.logoHref} @click=${(e: MouseEvent) => this.clic(e, enlace)}>
|
|
495
|
+
${contenido}
|
|
496
|
+
</a>`;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
private renderRed({ red, url, etiqueta }: RedFooter) {
|
|
500
|
+
const datos = iconosRedes[red];
|
|
501
|
+
if (!datos) return nothing;
|
|
502
|
+
return html`<li>
|
|
503
|
+
<a href=${url} target="_blank" rel="noopener noreferrer" aria-label=${etiqueta || datos.nombre} title=${etiqueta || datos.nombre}>
|
|
504
|
+
${datos.icono}
|
|
505
|
+
</a>
|
|
506
|
+
</li>`;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
private renderGrupo(grupo: GrupoFooter, indice: number) {
|
|
510
|
+
const abierto = !this.estrecho || this.abiertos.has(indice);
|
|
511
|
+
const idLista = `grupo-${indice}`;
|
|
512
|
+
return html`
|
|
513
|
+
<nav class="grupo" aria-label=${grupo.titulo}>
|
|
514
|
+
<h2 class="titulo">
|
|
515
|
+
${this.estrecho
|
|
516
|
+
? html`<button aria-expanded=${abierto} aria-controls=${idLista} @click=${() => this.alternar(indice)}>
|
|
517
|
+
${grupo.titulo} ${iconoChevronDown}
|
|
518
|
+
</button>`
|
|
519
|
+
: grupo.titulo}
|
|
520
|
+
</h2>
|
|
521
|
+
<ul class="enlaces" id=${idLista} ?hidden=${!abierto}>
|
|
522
|
+
${grupo.enlaces.map(
|
|
523
|
+
(enlace) => html`<li>
|
|
524
|
+
<a href=${enlace.href || '#'} @click=${(e: MouseEvent) => this.clic(e, enlace, grupo.titulo)}>
|
|
525
|
+
${enlace.texto}
|
|
526
|
+
</a>
|
|
527
|
+
</li>`,
|
|
528
|
+
)}
|
|
529
|
+
</ul>
|
|
530
|
+
</nav>
|
|
531
|
+
`;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
private renderPago(metodo: MetodoPago) {
|
|
535
|
+
const datos = metodosPago[metodo];
|
|
536
|
+
if (!datos) return nothing;
|
|
537
|
+
return html`<li class="pago ${metodo}" role="img" aria-label=${datos.nombre} title=${datos.nombre}>
|
|
538
|
+
${datos.contenido}
|
|
539
|
+
</li>`;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
private alternar(indice: number) {
|
|
543
|
+
const abiertos = new Set(this.abiertos);
|
|
544
|
+
if (!abiertos.delete(indice)) abiertos.add(indice);
|
|
545
|
+
this.abiertos = abiertos;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
private clic(evento: MouseEvent, enlace: EnlaceFooter, grupo?: string) {
|
|
549
|
+
// Ctrl/Cmd/Shift + clic o clic con rueda: que el navegador abra el href.
|
|
550
|
+
if (enlace.href && (evento.ctrlKey || evento.metaKey || evento.shiftKey || evento.button !== 0)) return;
|
|
551
|
+
evento.preventDefault();
|
|
552
|
+
emitir<DetalleClicEnlace>(this, 'clic-enlace', { enlace, grupo });
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
private revisarBoletin(evento: Event) {
|
|
556
|
+
this.conBoletin = (evento.target as HTMLSlotElement).assignedNodes({ flatten: true }).length > 0;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
declare global {
|
|
561
|
+
interface HTMLElementTagNameMap {
|
|
562
|
+
'lr-custom-footer': LrCustomFooter;
|
|
563
|
+
}
|
|
564
|
+
}
|