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 {% if media.IsVideo() %}
11 <video class="image is-fit" controls muted="true" poster="/media/thumbnail/?path_hash={%s media.PathHash %}" preload="{%s preloadAttr %}">
12 <source src="/media/image/?path_hash={%s media.PathHash %}" type="{%s media.MIMEType %}">
13 </video>
14 {% else %}
15 <figure class="image is-fit">
16 <img src="/media/thumbnail/?path_hash={%s media.PathHash %}">
17 </figure>
18 {% endif %}
19 </div>
20 {% endfor %}
21 </div>
22{% endfor %}
23</div>
24{% endfunc %}