ikurotime / gitgud

public
main / internal/interface/web/templates/commits.templ
1.0 KB · Templ Raw
 1package templates
 2
 3import "gitgud/internal/domain"
 4
 5templ Commits(user *domain.User, repo *domain.Repository, ref string, commits []domain.Commit) {
 6	@Layout("Commits · "+repo.Name, user) {
 7		@repoHeader(repo, "code")
 8		<div class="mb-4 flex items-center gap-2 text-sm">
 9			<span class="text-muted">Commits on</span>
10			<span class="badge font-mono">{ ref }</span>
11		</div>
12		<div class="card overflow-hidden">
13			for _, c := range commits {
14				<div class="row flex items-center justify-between border-b border-line px-4 py-3 last:border-0">
15					<div class="min-w-0">
16						<a class="block truncate text-ink hover:text-accent" href={ templ.SafeURL(repoPath(repo, "/commit/"+c.Hash)) }>{ firstLine(c.Message) }</a>
17						<div class="meta mt-0.5">{ c.Author } · { fmtTime(c.When) }</div>
18					</div>
19					<a class="ml-4 shrink-0 rounded-md border border-line2 bg-panel2 px-2 py-1 font-mono text-xs text-muted hover:text-ink" href={ templ.SafeURL(repoPath(repo, "/commit/"+c.Hash)) }>{ c.ShortHash }</a>
20				</div>
21			}
22		</div>
23	}
24}