Commit e2b454c

Nick Faro committed on
Match repository title styling
commit e2b454cb7c96c74149f862aca62dbbea73e2d339 parent cb22311
4 changed files +11−3
Modifiedinternal/site/site.go +6−1
@@ -103,6 +103,7 @@ type pageData struct {
103 Title string 103 Title string
104 BaseURL string 104 BaseURL string
105 RepoName string 105 RepoName string
106 RepoAvatarURL string
106 Owner string 107 Owner string
107 CloneURL string 108 CloneURL string
108 Branch string 109 Branch string
@@ -695,7 +696,7 @@ func (g *Generator) render(data pageData) ([]byte, error) {
695 } 696 }
696 697
697 func (g *Generator) pageData(kind, title, branch string, summary branchSummary) pageData { 698 func (g *Generator) pageData(kind, title, branch string, summary branchSummary) pageData {
698 return pageData{ 699 data := pageData{
699 Kind: kind, 700 Kind: kind,
700 Title: title, 701 Title: title,
701 BaseURL: g.BaseURL, 702 BaseURL: g.BaseURL,
@@ -720,6 +721,10 @@ func (g *Generator) pageData(kind, title, branch string, summary branchSummary)
720 ContributorCount: summary.Repository.ContributorCount, 721 ContributorCount: summary.Repository.ContributorCount,
721 AssetVersion: g.AssetVersion(), 722 AssetVersion: g.AssetVersion(),
722 } 723 }
724 if len(summary.Repository.Contributors) > 0 {
725 data.RepoAvatarURL = summary.Repository.Contributors[0].AvatarURL
726 }
727 return data
723 } 728 }
724 729
725 func (g *Generator) commitsPage(branch string, summary branchSummary) (Page, error) { 730 func (g *Generator) commitsPage(branch string, summary branchSummary) (Page, error) {
Modifiedinternal/site/site_test.go +1−0
@@ -56,6 +56,7 @@ func TestFullAndIncrementalBuild(t *testing.T) {
56 assertPageDoesNotContain(t, full, "", `href="https://example.invalid/repo.git">owner</a>`) 56 assertPageDoesNotContain(t, full, "", `href="https://example.invalid/repo.git">owner</a>`)
57 assertPage(t, full, "", "Languages") 57 assertPage(t, full, "", "Languages")
58 assertPage(t, full, "", "Contributors") 58 assertPage(t, full, "", "Contributors")
59 assertPage(t, full, "", `class="avatar repo-title-avatar"`)
59 assertPage(t, full, "", "octicon-folder") 60 assertPage(t, full, "", "octicon-folder")
60 assertPage(t, full, "blob/main/src/main.go", "chroma") 61 assertPage(t, full, "blob/main/src/main.go", "chroma")
61 assertPage(t, full, "blob/main/src/main.go", "data-file-tree") 62 assertPage(t, full, "blob/main/src/main.go", "data-file-tree")
Modifiedinternal/site/style.go +3−1
@@ -106,7 +106,9 @@ button, input { font: inherit; }
106 .blob-content-shell { max-width: 1600px; } 106 .blob-content-shell { max-width: 1600px; }
107 .repo-overview-head { min-height: 34px; margin-bottom: 18px; display: flex; align-items: center; gap: 16px; } 107 .repo-overview-head { min-height: 34px; margin-bottom: 18px; display: flex; align-items: center; gap: 16px; }
108 .repo-title { min-width: 0; display: flex; align-items: center; gap: 7px; font-size: 20px; } 108 .repo-title { min-width: 0; display: flex; align-items: center; gap: 7px; font-size: 20px; }
109 .repo-title > a { overflow: hidden; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; } 109 .repo-title > a { overflow: hidden; color: var(--text); font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
110 .repo-title > a:hover, .repo-title > a:focus { color: var(--text); text-decoration: underline; }
111 .repo-title-avatar { width: 24px; height: 24px; }
110 .repo-icon { display: inline-flex; color: var(--muted); } 112 .repo-icon { display: inline-flex; color: var(--muted); }
111 .repo-icon .icon { width: 18px; height: 18px; } 113 .repo-icon .icon { width: 18px; height: 18px; }
112 .visibility { color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 600; } 114 .visibility { color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 600; }
Modifiedinternal/site/template.go +1−1
@@ -29,7 +29,7 @@ const pageTemplate = `<!doctype html>
29 <div class="content-shell {{if or (eq .Kind "blob") (eq .Kind "commit")}}blob-content-shell{{end}}"> 29 <div class="content-shell {{if or (eq .Kind "blob") (eq .Kind "commit")}}blob-content-shell{{end}}">
30 {{if eq .Kind "repo"}} 30 {{if eq .Kind "repo"}}
31 <div class="repo-overview-head"> 31 <div class="repo-overview-head">
32 <div class="repo-title"><span class="repo-icon">{{icon "repo"}}</span><a href="{{.BaseURL}}">{{.RepoName}}</a><span class="visibility">Public</span></div> 32 <div class="repo-title">{{if .RepoAvatarURL}}<img class="avatar repo-title-avatar" src="{{.RepoAvatarURL}}" alt="" referrerpolicy="no-referrer">{{else}}<span class="repo-icon">{{icon "repo"}}</span>{{end}}<a href="{{.BaseURL}}">{{.RepoName}}</a><span class="visibility">Public</span></div>
33 <a class="secondary-button fork-button" href="{{.GitHubImportURL}}" target="_blank" rel="noopener" data-copy="{{.CloneURL}}" data-copied-label="URL copied — paste on GitHub" aria-label="Copy clone URL and open GitHub Importer" title="Copies the clone URL, then opens GitHub Importer">{{icon "fork"}} <span data-copy-label>Import to GitHub</span></a> 33 <a class="secondary-button fork-button" href="{{.GitHubImportURL}}" target="_blank" rel="noopener" data-copy="{{.CloneURL}}" data-copied-label="URL copied — paste on GitHub" aria-label="Copy clone URL and open GitHub Importer" title="Copies the clone URL, then opens GitHub Importer">{{icon "fork"}} <span data-copy-label>Import to GitHub</span></a>
34 </div> 34 </div>
35 <div class="repo-grid"> 35 <div class="repo-grid">