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