mirror of
https://gitlab.com/vyla-entertainment/home-frontend.git
synced 2026-11-15 03:37:26 -05:00
updated UI
This commit is contained in:
@@ -1,17 +1,20 @@
|
||||
import { getPartners } from '../services/partners-service.js';
|
||||
import { createElement } from '../utils/dom.js';
|
||||
import { observeReveals } from '../animations/reveal-observer.js';
|
||||
import { shouldReduceEffects } from '../utils/device-capability.js';
|
||||
|
||||
function createPartnerItem(partner) {
|
||||
const item = createElement('div', 'partner-item reveal');
|
||||
const item = createElement('div', 'partner-item');
|
||||
let imgHTML;
|
||||
|
||||
if (partner.logo) {
|
||||
if (partner.logoSmall) {
|
||||
imgHTML = `<img src="${partner.logoSmall}" alt="${partner.name}" width="128" height="128" loading="lazy" decoding="async"
|
||||
fetchpriority="low"
|
||||
srcset="${partner.logoSmall} 64w, ${partner.logo} 128w" sizes="64px">`;
|
||||
} else {
|
||||
imgHTML = `<img src="${partner.logo}" alt="${partner.name}" width="128" height="128" loading="lazy" decoding="async">`;
|
||||
imgHTML = `<img src="${partner.logo}" alt="${partner.name}" width="128" height="128" loading="lazy" decoding="async"
|
||||
fetchpriority="low">`;
|
||||
}
|
||||
} else {
|
||||
imgHTML = '';
|
||||
@@ -32,7 +35,12 @@ export async function initPartnersSection() {
|
||||
const partners = await getPartners();
|
||||
grid.innerHTML = '';
|
||||
partners.forEach((partner) => grid.appendChild(createPartnerItem(partner)));
|
||||
observeReveals(grid);
|
||||
|
||||
if (shouldReduceEffects()) {
|
||||
grid.classList.add('in-view');
|
||||
} else {
|
||||
observeReveals(grid);
|
||||
}
|
||||
} catch (error) {
|
||||
grid.innerHTML = '';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user