{{ define "search/fragments/resultCard" }} {{ $root := index . 0 }} {{ $result := index . 1 }} {{ $owner := resolve $result.Repo.Did }} {{ $slug := $result.Repo.Slug }}
{{ template "user/fragments/pic" (list $result.Repo.Did "size-5") }} {{ $owner }}/{{ $slug }}
{{ range $result.Branches }} {{ . }} {{ end }}
{{ with $result.Repo.RepoStats }}
{{ i "star" "size-4" }} {{ scaleFmt .StarCount }}
{{ end }}
{{ if $result.File }} {{/* filename match */}}
{{ with $result.Language }} {{ template "repo/fragments/colorBall" (dict "color" (langColor .)) }} {{ . }} {{ end }}
{{ else if $result.Chunks }} {{/* chunk match */}}
{{ i "file" "size-4 flex-shrink-0" }} {{ $result.FilePath }}
{{ with $result.Language }} {{ template "repo/fragments/colorBall" (dict "color" (langColor .)) }} {{ . }} {{ end }}
{{ range $i, $chunk := $result.Chunks }} {{ if lt $i 3 }} {{ if gt $i 0 }}
···
{{ end }} {{ template "search/fragments/chunkBody" (dict "Owner" $owner "Slug" $slug "Commit" $result.Commit "FilePath" $result.FilePath "Chunk" $chunk) }} {{ end }} {{ end }} {{ if gt (len $result.Chunks) 3 }}
{{ i "chevron-down" "size-3 m-1" }} Show {{ (slice $result.Chunks 3).MatchCount }} more matches
{{ range $i, $chunk := $result.Chunks }} {{ if ge $i 3 }}
···
{{ template "search/fragments/chunkBody" (dict "Owner" $owner "Slug" $slug "Commit" $result.Commit "FilePath" $result.FilePath "Chunk" $chunk) }} {{ end }} {{ end }}
{{ end }}
{{ else }} {{/* repo match */}}
{{ with $result.Repo.Description }}
{{ . | description }}
{{ end }} {{ with $result.Repo.RepoStats }} {{ with .Language }}
{{ template "repo/fragments/colorBall" (dict "color" (langColor .)) }} {{ . }}
{{ end }} {{ end }}
{{ end }}
{{ end }}