package main // lightboxGalleryComponent renders the gallery grid with lightbox triggers. templ lightboxGalleryComponent(items []LightboxItem, cols int) {
if len(items) == 0 {
Add photographs to populate the gallery.
} else {
for i, item := range items {
if item.Caption != "" {
{ item.Caption }
}
}
}
} // lightboxGridCols returns Tailwind grid-template-columns utility for the requested columns. func lightboxGridCols(cols int) string { switch cols { case 2: return "grid-cols-1 md:grid-cols-2" case 4: return "grid-cols-1 md:grid-cols-2 lg:grid-cols-4" default: // 3 return "grid-cols-1 md:grid-cols-2 lg:grid-cols-3" } } // lightboxAriaLabel builds an accessible button label for each gallery entry. func lightboxAriaLabel(index int, caption string) string { if caption != "" { return "Open photograph: " + caption } return "Open photograph " + intToString(index+1) } // intToString avoids importing strconv into a templ-generated file. func intToString(n int) string { if n == 0 { return "0" } neg := false if n < 0 { neg = true n = -n } var b [20]byte i := len(b) for n > 0 { i-- b[i] = byte('0' + n%10) n /= 10 } if neg { i-- b[i] = '-' } return string(b[i:]) }