// construcción de cards let html = ''; for (let album of filteredData) { // tipo legible let typeLabel = ''; let typeIcon = ''; if (album.type === 'estudio') { typeLabel = 'Álbum de estudio'; typeIcon = '🎙️'; } else if (album.type === 'ep') { typeLabel = 'EP / Extended Play'; typeIcon = '💿'; } else if (album.type === 'live') { typeLabel = 'En vivo / Concierto'; typeIcon = '🎤'; }
<div class="hero"> <h1><i class="fas fa-dove"></i> ENJAMBRE <i class="fas fa-guitar"></i></h1> <p>Discografía completa · Estudio, EPs, En vivo · <i class="fas fa-head-side-vr"></i> legado sonoro mexicano</p> </div>
// filtrar discos según filtro + búsqueda function filterDiscos() { let filtered = [...discography];
// añadir efecto de pequeño detalle extra: click en estadística para resetear búsqueda opcional (doble click) statsSpan.addEventListener('dblclick', () => { searchInput.value = ''; currentSearch = ''; render(); searchInput.focus(); }); // tooltip informal statsSpan.title = "Doble clic para limpiar búsqueda"; </script> </body> </html> enjambre discografia
// elementos DOM const gridContainer = document.getElementById('discogGrid'); const searchInput = document.getElementById('searchInput'); const filterBtns = document.querySelectorAll('.filter-btn'); const statsSpan = document.getElementById('statsCounter');
/* controls bar */ .controls { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; background: #fffcf7; padding: 1.2rem 2rem; border-bottom: 1px solid #e2d5c8; box-shadow: 0 2px 8px rgba(0,0,0,0.02); } .search-box { flex: 2; min-width: 200px; display: flex; align-items: center; background: #f3ede7; border-radius: 60px; padding: 0.4rem 1rem; border: 1px solid #e0cfc0; transition: all 0.2s; } .search-box i { color: #aa7e5a; margin-right: 10px; font-size: 1.1rem; } .search-box input { background: transparent; border: none; padding: 0.7rem 0; font-size: 1rem; width: 100%; outline: none; font-weight: 400; font-family: 'Inter', monospace; } .filter-buttons { display: flex; flex-wrap: wrap; gap: 0.6rem; } .filter-btn { background: #ede4db; border: none; padding: 0.5rem 1.2rem; border-radius: 40px; font-weight: 500; font-size: 0.85rem; cursor: pointer; transition: all 0.2s ease; font-family: 'Inter', sans-serif; color: #3a2e26; display: inline-flex; align-items: center; gap: 6px; } .filter-btn i { font-size: 0.8rem; } .filter-btn.active { background: #aa7e5a; color: white; box-shadow: 0 4px 10px rgba(170,126,90,0.3); } .filter-btn:hover:not(.active) { background: #d6c8bc; transform: translateY(-1px); } .stats { background: #e9dfd5; padding: 0.4rem 1rem; border-radius: 40px; font-size: 0.85rem; font-weight: 500; color: #4a372a; }
// renderizar grid con animación sencilla function render() { const filteredData = filterDiscos(); const total = filteredData.length; statsSpan.innerHTML = `📀 ${total} ${total === 1 ? 'disco' : 'discos'}`; // construcción de cards let html = '';
<footer> <i class="fas fa-crown"></i> Enjambre · discografía esencial 2006–2024 · hecha con <i class="fas fa-heart" style="color:#b47c48;"></i> para los seguidores </footer>
// evento búsqueda searchInput.addEventListener('input', onSearchInput);
<div class="controls"> <div class="search-box"> <i class="fas fa-search"></i> <input type="text" id="searchInput" placeholder="Buscar por álbum, año o canción..."> </div> <div class="filter-buttons" id="filterGroup"> <button class="filter-btn active" data-filter="all"><i class="fas fa-album-collection"></i> Todos</button> <button class="filter-btn" data-filter="estudio"><i class="fas fa-microphone-alt"></i> Estudio</button> <button class="filter-btn" data-filter="ep"><i class="fas fa-compact-disc"></i> EP</button> <button class="filter-btn" data-filter="live"><i class="fas fa-drumstick-bite"></i> En vivo</button> </div> <div class="stats" id="statsCounter">🎵 0 discos</div> </div> let typeIcon = ''
// filtrar por tipo if (currentFilter !== 'all') { filtered = filtered.filter(album => album.type === currentFilter); }
/* discography grid */ .container { max-width: 1400px; margin: 2rem auto; padding: 0 1.5rem; } .discog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 2rem; } .card { background: #ffffffea; backdrop-filter: blur(0px); border-radius: 28px; overflow: hidden; box-shadow: 0 12px 24px -12px rgba(0,0,0,0.2); transition: transform 0.25s ease, box-shadow 0.3s; border: 1px solid #f0e2d4; } .card:hover { transform: translateY(-6px); box-shadow: 0 20px 30px -12px rgba(0,0,0,0.25); } .card-img { height: 220px; background: #d9cdbf; display: flex; align-items: center; justify-content: center; font-size: 4rem; color: #7c5f45; position: relative; background-size: cover; background-position: center; background-repeat: no-repeat; transition: all 0.2s; } /* fallback icon if no image bg */ .card-img i { text-shadow: 2px 2px 0 rgba(0,0,0,0.1); } .card-content { padding: 1.5rem 1.3rem 1.8rem; } .album-year { font-size: 0.8rem; letter-spacing: 1px; font-weight: 600; color: #b47c48; text-transform: uppercase; display: flex; justify-content: space-between; align-items: center; } .album-title { font-size: 1.7rem; font-weight: 700; margin: 0.4rem 0 0.5rem; line-height: 1.2; color: #231f1b; } .album-type { display: inline-block; background: #f0e4d8; padding: 0.2rem 0.9rem; border-radius: 20px; font-size: 0.7rem; font-weight: 600; margin-bottom: 0.8rem; text-transform: uppercase; } .tracklist { margin-top: 1rem; border-top: 1px dashed #e5d5c6; padding-top: 0.9rem; } .tracklist h4 { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #aa7e5a; margin-bottom: 0.6rem; display: flex; align-items: center; gap: 6px; } .tracklist ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0.3rem 0.7rem; } .tracklist li { font-size: 0.8rem; background: #f8f2ec; padding: 0.2rem 0.6rem; border-radius: 20px; color: #4e3a2c; font-weight: 400; } .no-results { text-align: center; grid-column: 1 / -1; padding: 4rem; background: #f4ede6; border-radius: 60px; font-size: 1.2rem; color: #876e55; } footer { text-align: center; padding: 2rem; font-size: 0.8rem; color: #7c6857; border-top: 1px solid #e2cfbf; margin-top: 2rem; } @media (max-width: 650px) { .hero h1 { font-size: 2.5rem; } .controls { flex-direction: column; align-items: stretch; } .filter-buttons { justify-content: center; } .discog-grid { gap: 1.2rem; } .album-title { font-size: 1.4rem; } } </style> </head> <body>
// evento de búsqueda con debounce suave let debounceTimer; function onSearchInput() { clearTimeout(debounceTimer); debounceTimer = setTimeout(() => { currentSearch = searchInput.value; render(); }, 280); }