appview/pages: introduce "tinyAvatarList" template #862

merged
opened by oppi.li targeting master from op/rkowwwsvpoqx

given a list of DIDs, this forms a list of profile pictures capped at 5 profile pictures. this component will be used to represent a collection of users (e.g.: participants, coauthors).

Signed-off-by: oppiliappan me@oppi.li

Changed files
+23 -16
appview
pages
templates
fragments
repo
fragments
+22
appview/pages/templates/fragments/tinyAvatarList.html
···
+
{{ define "fragments/tinyAvatarList" }}
+
{{ $all := .all }}
+
{{ $classes := .classes }}
+
{{ $ps := take $all 5 }}
+
<div class="inline-flex items-center -space-x-3">
+
{{ $c := "z-50 z-40 z-30 z-20 z-10" }}
+
{{ range $i, $p := $ps }}
+
<img
+
src="{{ tinyAvatar . }}"
+
alt=""
+
class="rounded-full size-8 mr-1 border-2 border-gray-100 dark:border-gray-900 z-{{sub 5 $i}}0 {{ $classes }}"
+
/>
+
{{ end }}
+
+
{{ if gt (len $all) 5 }}
+
<span class="pl-4 text-gray-500 dark:text-gray-400 text-sm">
+
+{{ sub (len $all) 5 }}
+
</span>
+
{{ end }}
+
</div>
+
{{ end }}
+
+1 -16
appview/pages/templates/repo/fragments/participants.html
···
<span class="font-bold text-gray-500 dark:text-gray-400 capitalize">Participants</span>
<span class="bg-gray-200 dark:bg-gray-700 rounded py-1/2 px-1 ml-1">{{ len $all }}</span>
</div>
-
<div class="flex items-center -space-x-3 mt-2">
-
{{ $c := "z-50 z-40 z-30 z-20 z-10" }}
-
{{ range $i, $p := $ps }}
-
<img
-
src="{{ tinyAvatar . }}"
-
alt=""
-
class="rounded-full h-8 w-8 mr-1 border-2 border-gray-100 dark:border-gray-900 z-{{sub 5 $i}}0"
-
/>
-
{{ end }}
-
-
{{ if gt (len $all) 5 }}
-
<span class="pl-4 text-gray-500 dark:text-gray-400 text-sm">
-
+{{ sub (len $all) 5 }}
-
</span>
-
{{ end }}
-
</div>
+
{{ template "fragments/tinyAvatarList" (dict "all" $all "classes" "w-8 h-8") }}
</div>
{{ end }}