585f620bd6
This commit includes two major improvements:
1. Hyperscript Code Organization:
- Extracted all hyperscript blocks >3 lines into reusable functions
- Created 6 new functions in functions._hs:
* toggleCVLength(isLong) - CV length toggle sync
* toggleIcons(showIcons) - Icons toggle sync
* toggleTheme(isClean) - Theme toggle sync
* syncPdfHover(show) - PDF button synchronized hover
* syncPrintHover(show) - Print button synchronized hover
* highlightZoomControl(show) - Zoom control highlight effect
- Reduced inline hyperscript from 11+ lines to 1-2 lines per element
- Updated 8 template files to use function calls:
* hamburger-menu.html
* view-controls.html
* action-buttons.html
* download-button.html
* print-friendly-button.html
* zoom-toggle-button.html
2. Mobile Button Layout (max-width: 900px):
- Repositioned three fixed buttons (PDF, Print, Info) horizontally at bottom center
- Print button perfectly centered in viewport
- Download button on left, Info button on right
- Hidden zoom and shortcuts buttons on mobile (available in hamburger menu)
- Removed conflicting old mobile styles that were hiding print button
- Smooth hover transitions maintained with proper transform calculations
Technical details:
- Used CSS transform with calc() for precise horizontal positioning
- Maintained hover effects with combined translateX/translateY transforms
- Ensured accessibility with proper ARIA labels and spacing
- All functions check element existence before manipulation
- LocalStorage sync maintained across desktop/mobile toggles
194 lines
12 KiB
HTML
194 lines
12 KiB
HTML
{{define "hamburger-menu"}}
|
|
<!-- Navigation Menu (Hidden by default) -->
|
|
<nav id="navigation-menu" class="navigation-menu no-print" role="navigation" aria-label="CV sections">
|
|
<div class="menu-content">
|
|
<!-- CV Sections - Quick Navigation -->
|
|
<div class="menu-item-submenu">
|
|
<a href="#" class="menu-item has-submenu">
|
|
<iconify-icon icon="mdi:menu" width="20" height="20"></iconify-icon>
|
|
<span>{{if eq .Lang "es"}}Secciones CV{{else}}CV Sections{{end}}</span>
|
|
<iconify-icon icon="mdi:chevron-right" width="16" height="16" class="submenu-arrow"></iconify-icon>
|
|
</a>
|
|
<div class="submenu-content">
|
|
<a href="#education" class="menu-item"
|
|
_="on click call event.preventDefault() then call document.getElementById('education').scrollIntoView({behavior: 'smooth'})">
|
|
<iconify-icon icon="mdi:school" width="20" height="20"></iconify-icon>
|
|
<span>{{if eq .Lang "es"}}Formación{{else}}Training{{end}}</span>
|
|
</a>
|
|
<a href="#skills" class="menu-item"
|
|
_="on click call event.preventDefault() then call document.getElementById('skills').scrollIntoView({behavior: 'smooth'})">
|
|
<iconify-icon icon="mdi:brain" width="20" height="20"></iconify-icon>
|
|
<span>{{if eq .Lang "es"}}Competencias{{else}}Skills{{end}}</span>
|
|
</a>
|
|
<a href="#experience" class="menu-item"
|
|
_="on click call event.preventDefault() then call document.getElementById('experience').scrollIntoView({behavior: 'smooth'})">
|
|
<iconify-icon icon="mdi:office-building" width="20" height="20"></iconify-icon>
|
|
<span>{{if eq .Lang "es"}}Experiencia{{else}}Experience{{end}}</span>
|
|
</a>
|
|
<a href="#awards" class="menu-item"
|
|
_="on click call event.preventDefault() then call document.getElementById('awards').scrollIntoView({behavior: 'smooth'})">
|
|
<iconify-icon icon="mdi:trophy" width="20" height="20"></iconify-icon>
|
|
<span>{{if eq .Lang "es"}}Premios y Reconocimientos{{else}}Awards{{end}}</span>
|
|
</a>
|
|
<a href="#projects" class="menu-item"
|
|
_="on click call event.preventDefault() then call document.getElementById('projects').scrollIntoView({behavior: 'smooth'})">
|
|
<iconify-icon icon="mdi:web" width="20" height="20"></iconify-icon>
|
|
<span>{{if eq .Lang "es"}}Proyectos Personales / Freelance{{else}}Personal / Freelance Projects{{end}}</span>
|
|
</a>
|
|
<a href="#courses" class="menu-item"
|
|
_="on click call event.preventDefault() then call document.getElementById('courses').scrollIntoView({behavior: 'smooth'})">
|
|
<iconify-icon icon="mdi:school" width="20" height="20"></iconify-icon>
|
|
<span>{{if eq .Lang "es"}}Cursos Realizados{{else}}Courses{{end}}</span>
|
|
</a>
|
|
<a href="#languages" class="menu-item"
|
|
_="on click call event.preventDefault() then call document.getElementById('languages').scrollIntoView({behavior: 'smooth'})">
|
|
<iconify-icon icon="mdi:translate" width="20" height="20"></iconify-icon>
|
|
<span>{{if eq .Lang "es"}}Idiomas{{else}}Languages{{end}}</span>
|
|
</a>
|
|
<a href="#references" class="menu-item"
|
|
_="on click call event.preventDefault() then call document.getElementById('references').scrollIntoView({behavior: 'smooth'})">
|
|
<iconify-icon icon="mdi:link-variant" width="20" height="20"></iconify-icon>
|
|
<span>{{if eq .Lang "es"}}Referencias{{else}}References{{end}}</span>
|
|
</a>
|
|
<a href="#other" class="menu-item"
|
|
_="on click call event.preventDefault() then call document.getElementById('other').scrollIntoView({behavior: 'smooth'})">
|
|
<iconify-icon icon="mdi:information" width="20" height="20"></iconify-icon>
|
|
<span>{{if eq .Lang "es"}}Otros{{else}}Other{{end}}</span>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Quick Actions Section -->
|
|
<div class="menu-section-wrapper">
|
|
<div class="menu-item menu-item-header">
|
|
<iconify-icon icon="mdi:cog-outline" width="20" height="20"></iconify-icon>
|
|
<span>{{if eq .Lang "es"}}Acciones Rápidas{{else}}Quick Actions{{end}}</span>
|
|
</div>
|
|
|
|
<a href="#" class="menu-item menu-item-action" onclick="collapseAllSections(event)">
|
|
<iconify-icon icon="mdi:arrow-collapse-all" width="20" height="20"></iconify-icon>
|
|
<span>{{if eq .Lang "es"}}Colapsar Todo{{else}}Collapse All{{end}}</span>
|
|
</a>
|
|
<a href="#" class="menu-item menu-item-action" onclick="expandAllSections(event)">
|
|
<iconify-icon icon="mdi:arrow-expand-all" width="20" height="20"></iconify-icon>
|
|
<span>{{if eq .Lang "es"}}Expandir Todo{{else}}Expand All{{end}}</span>
|
|
</a>
|
|
<a href="#" id="show-zoom-menu-btn" class="menu-item menu-item-action zoom-hidden">
|
|
<iconify-icon icon="mdi:magnify" width="20" height="20"></iconify-icon>
|
|
<span>{{if eq .Lang "es"}}Zoom{{else}}Zoom{{end}}</span>
|
|
</a>
|
|
</div>
|
|
|
|
<!-- View Controls in menu (visible only on mobile < 900px) -->
|
|
<div class="menu-controls-section">
|
|
<div class="menu-item menu-item-header">
|
|
<iconify-icon icon="mdi:tune-variant" width="20" height="20"></iconify-icon>
|
|
<span>{{if eq .Lang "es"}}Controles de Vista{{else}}View Controls{{end}}</span>
|
|
</div>
|
|
|
|
<!-- CV Length toggle -->
|
|
<div class="menu-control-item" id="mobile-length-toggle">
|
|
<label class="menu-control-label">
|
|
<iconify-icon icon="mdi:file-document-outline" width="20" height="20"></iconify-icon>
|
|
<span>{{if eq .Lang "es"}}Longitud{{else}}Length{{end}}</span>
|
|
</label>
|
|
<div style="display: flex; align-items: center; gap: 8px;">
|
|
<label class="icon-toggle">
|
|
<input type="checkbox"
|
|
id="lengthToggleMenu"
|
|
{{if eq .CVLengthClass "cv-long"}}checked{{end}}
|
|
hx-post="/toggle/length?lang={{.Lang}}"
|
|
hx-swap="none"
|
|
_="on change call toggleCVLength(my.checked)">
|
|
<span class="icon-toggle-slider">
|
|
<iconify-icon icon="mdi:file-document-outline" width="16" height="16" class="icon-left"></iconify-icon>
|
|
<iconify-icon icon="mdi:file-document-multiple-outline" width="16" height="16" class="icon-right"></iconify-icon>
|
|
</span>
|
|
</label>
|
|
<iconify-icon icon="mdi:loading"
|
|
class="htmx-indicator spinning small dark"
|
|
width="14"
|
|
height="14"
|
|
aria-label="Saving"></iconify-icon>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Icon toggle -->
|
|
<div class="menu-control-item" id="mobile-icon-toggle">
|
|
<label class="menu-control-label">
|
|
<iconify-icon icon="mdi:image-multiple-outline" width="20" height="20"></iconify-icon>
|
|
<span>{{if eq .Lang "es"}}Iconos{{else}}Icons{{end}}</span>
|
|
</label>
|
|
<div style="display: flex; align-items: center; gap: 8px;">
|
|
<label class="icon-toggle">
|
|
<input type="checkbox"
|
|
id="iconToggleMenu"
|
|
{{if .ShowIcons}}checked{{end}}
|
|
hx-post="/toggle/icons?lang={{.Lang}}"
|
|
hx-swap="none"
|
|
_="on change call toggleIcons(my.checked)">
|
|
<span class="icon-toggle-slider">
|
|
<iconify-icon icon="mdi:image-off-outline" width="16" height="16" class="icon-left"></iconify-icon>
|
|
<iconify-icon icon="mdi:image-multiple-outline" width="16" height="16" class="icon-right"></iconify-icon>
|
|
</span>
|
|
</label>
|
|
<iconify-icon icon="mdi:loading"
|
|
class="htmx-indicator spinning small dark"
|
|
width="14"
|
|
height="14"
|
|
aria-label="Saving"></iconify-icon>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Theme toggle -->
|
|
<div class="menu-control-item" id="mobile-theme-toggle">
|
|
<label class="menu-control-label">
|
|
<iconify-icon icon="mdi:page-layout-sidebar-left" width="20" height="20"></iconify-icon>
|
|
<span>{{if eq .Lang "es"}}Vista{{else}}View{{end}}</span>
|
|
</label>
|
|
<div style="display: flex; align-items: center; gap: 8px;">
|
|
<label class="icon-toggle">
|
|
<input type="checkbox"
|
|
id="themeToggleMenu"
|
|
{{if .ThemeClean}}checked{{end}}
|
|
hx-post="/toggle/theme?lang={{.Lang}}"
|
|
hx-swap="none"
|
|
_="on change call toggleTheme(my.checked)">
|
|
<span class="icon-toggle-slider">
|
|
<iconify-icon icon="mdi:page-layout-sidebar-left" width="16" height="16" class="icon-left"></iconify-icon>
|
|
<iconify-icon icon="mdi:page-layout-body" width="16" height="16" class="icon-right"></iconify-icon>
|
|
</span>
|
|
</label>
|
|
<iconify-icon icon="mdi:loading"
|
|
class="htmx-indicator spinning small dark"
|
|
width="14"
|
|
height="14"
|
|
aria-label="Saving"></iconify-icon>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Action Buttons in menu (visible only on mobile < 900px) -->
|
|
<div class="menu-actions-section">
|
|
<div class="menu-item menu-item-header">
|
|
<iconify-icon icon="mdi:lightning-bolt" width="20" height="20"></iconify-icon>
|
|
<span>{{if eq .Lang "es"}}Acciones{{else}}Actions{{end}}</span>
|
|
</div>
|
|
|
|
<button class="menu-action-btn" onclick="document.getElementById('pdf-modal').showModal()">
|
|
<iconify-icon icon="catppuccin:pdf" width="20" height="20"></iconify-icon>
|
|
<span>{{if eq .Lang "es"}}Descargar como PDF{{else}}Download as PDF{{end}}</span>
|
|
</button>
|
|
|
|
<button class="menu-action-btn menu-print-btn"
|
|
_="on click call printFriendly()
|
|
on mouseenter call syncPrintHover(true)
|
|
on mouseleave call syncPrintHover(false)">
|
|
<iconify-icon icon="mdi:leaf" width="20" height="20"></iconify-icon>
|
|
<span>{{if eq .Lang "es"}}Imprimir amigable{{else}}Print Friendly{{end}}</span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
{{end}}
|