1{% import "git.sr.ht/~gabrielgio/img/pkg/database/repository" %}
2{% import "git.sr.ht/~gabrielgio/img/pkg/list" %}
3
4{% func Mosaic(medias []*repository.Media, preloadAttr string) %}
5<div class="columns">
6{% for _, c := range list.Distribuite(medias, 6) %}
7 <div class="column is-2">
8 {% for _, media := range c %}
9 <div class="card-image">
10 <a href="/detail?path_hash={%s media.PathHash %}">
11 {% if media.IsVideo() %}
12 <video class="image is-fit" controls muted="true" poster="/media/thumbnail?path_hash={%s media.PathHash %}" preload="{%s preloadAttr %}">
13 <source src="/media/image?path_hash={%s media.PathHash %}" type="{%s media.MIMEType %}">
14 </video>
15 {% else %}
16 <figure class="image is-fit">
17 <img src="/media/thumbnail?path_hash={%s media.PathHash %}">
18 </figure>
19 </a>
20 {% endif %}
21 </div>
22 {% endfor %}
23 </div>
24{% endfor %}
25</div>
26{% endfunc %}