{{ define "timeline/fragments/trending" }}

{{ i "trending-up" "size-4 flex-shrink-0" }} Trending

{{ if .Repos }}
{{ range $index, $repo := .Repos }} {{ template "singleLineRepo" (list $ $repo) }} {{ end }}
{{ else }}
No trending repositories this week
{{ end }}
{{ end }} {{ define "singleLineRepo" }} {{ $root := index . 0 }} {{ $repo := index . 1 }} {{ with $repo }} {{ $repoOwner := resolve .Did }} {{/* a real anchor per row: a stretched (absolute inset-0) link inside a position:relative table row breaks hit-testing on safari, which does not support positioned table rows as containing blocks */}}
{{ i "star" "w-3 h-3 fill-current shrink-0 mt-1" }} {{ if .RepoStats }} {{ scaleFmt .RepoStats.StarCount }} {{ else }} 0 {{ end }}
{{ $repoOwner }}/{{ .Name }} {{ with .Description }} {{ . | description }} {{ end }}
{{ if and .RepoStats .RepoStats.Language }} {{ $lang := .RepoStats.Language }} {{ $display := $lang }} {{ if gt (len $lang) 6 }} {{ $display = .RepoStats.LangShortName }} {{ end }}
{{ template "repo/fragments/colorBall" (dict "color" (langColor $lang)) }} {{ $display }}
{{ end }}
{{ end }} {{ end }}