Files
go-gh-page/pkg/templates/main.html
2025-05-05 21:55:21 -04:00

381 lines
8.2 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{.PageTitle}}</title>
<style>
/* Base styles */
:root {
--primary-color: #0366d6;
--secondary-color: #586069;
--background-color: #ffffff;
--sidebar-bg: #f6f8fa;
--border-color: #e1e4e8;
--hover-color: #f1f1f1;
--text-color: #24292e;
--sidebar-width: 260px;
--breakpoint: 768px;
}
* {
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
line-height: 1.5;
color: var(--text-color);
margin: 0;
padding: 0;
display: flex;
min-height: 100vh;
}
a {
color: var(--primary-color);
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
h1, h2, h3, h4, h5, h6 {
margin-top: 24px;
margin-bottom: 16px;
font-weight: 600;
line-height: 1.25;
}
h1 {
font-size: 2em;
padding-bottom: 0.3em;
border-bottom: 1px solid var(--border-color);
}
h2 {
font-size: 1.5em;
padding-bottom: 0.3em;
border-bottom: 1px solid var(--border-color);
}
pre, code {
font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
font-size: 85%;
}
pre {
padding: 16px;
overflow: auto;
line-height: 1.45;
background-color: var(--sidebar-bg);
border-radius: 3px;
}
code {
padding: 0.2em 0.4em;
margin: 0;
background-color: rgba(27, 31, 35, 0.05);
border-radius: 3px;
}
pre code {
padding: 0;
background-color: transparent;
}
img {
max-width: 100%;
height: auto;
}
table {
border-collapse: collapse;
width: 100%;
margin: 16px 0;
}
table th, table td {
padding: 6px 13px;
border: 1px solid var(--border-color);
}
table tr {
background-color: var(--background-color);
border-top: 1px solid var(--border-color);
}
table tr:nth-child(2n) {
background-color: var(--sidebar-bg);
}
/* Layout */
.nav-sidebar {
width: var(--sidebar-width);
background-color: var(--sidebar-bg);
border-right: 1px solid var(--border-color);
overflow-y: auto;
position: sticky;
top: 0;
height: 100vh;
padding: 20px;
}
.main-content {
flex: 1;
padding: 40px;
max-width: 1200px;
margin: 0 auto;
}
/* Navigation */
.repo-info {
margin-bottom: 20px;
}
.repo-info h2 {
margin: 0;
border: none;
font-size: 1.25em;
display: flex;
align-items: center;
}
.repo-meta {
font-size: 0.9em;
color: var(--secondary-color);
}
.nav-links {
list-style-type: none;
padding: 0;
margin: 0 0 20px 0;
}
.nav-links li {
margin-bottom: 8px;
}
.nav-links a {
display: block;
padding: 6px 8px;
border-radius: 3px;
}
.nav-links a:hover {
background-color: var(--hover-color);
text-decoration: none;
}
.nav-links a.active {
font-weight: 600;
background-color: rgba(3, 102, 214, 0.1);
}
.nav-section-title {
font-weight: 600;
margin: 16px 0 8px 0;
color: var(--secondary-color);
}
.nav-footer {
margin-top: 20px;
font-size: 0.9em;
color: var(--secondary-color);
}
/* Repository sections */
.repo-header {
margin-bottom: 30px;
}
.repo-stats {
display: flex;
flex-wrap: wrap;
gap: 16px;
margin-bottom: 16px;
font-size: 0.9em;
}
.repo-stat {
display: flex;
align-items: center;
gap: 5px;
}
.repo-section {
margin-bottom: 40px;
}
.contributors-list {
display: flex;
flex-wrap: wrap;
gap: 20px;
margin-top: 20px;
}
.contributor-item {
flex: 1 1 calc(33% - 20px);
min-width: 200px;
display: flex;
align-items: center;
gap: 10px;
padding: 12px;
border: 1px solid var(--border-color);
border-radius: 3px;
background-color: var(--background-color);
}
.contributor-avatar {
width: 40px;
height: 40px;
border-radius: 50%;
background-color: var(--primary-color);
color: white;
text-align: center;
line-height: 40px;
font-size: 18px;
}
.contributor-info {
flex: 1;
}
.contributor-name {
font-weight: 600;
}
.contributor-commits {
font-size: 0.9em;
color: var(--secondary-color);
}
.page-footer {
margin-top: 40px;
padding-top: 20px;
border-top: 1px solid var(--border-color);
color: var(--secondary-color);
font-size: 0.9em;
}
/* Mobile responsive */
@media (max-width: 768px) {
body {
flex-direction: column;
}
.nav-sidebar {
width: 100%;
height: auto;
position: relative;
border-right: none;
border-bottom: 1px solid var(--border-color);
padding: 15px;
}
.main-content {
padding: 20px;
}
.contributor-item {
flex: 1 1 100%;
}
}
</style>
<link rel="stylesheet" href="/style.css">
</head>
<body>
<nav class="nav-sidebar">
<div class="repo-info">
<h2>
<a href="index.html">{{.RepoFullName}}</a>
</h2>
<div class="repo-meta">
{{if .CommitCount}}📝 {{.CommitCount}} commits{{end}}
{{if .License}} • 📜 {{.License}}{{end}}
</div>
</div>
<ul class="nav-links">
<li><a href="index.html" class="active">Repository Overview</a></li>
{{if .DocsPages}}
<div class="nav-section-title">Documentation:</div>
{{range .DocsPages}}
<li><a href="{{.Path}}">{{.Title}}</a></li>
{{end}}
{{end}}
</ul>
<div class="nav-footer">
<a href="{{.RepoURL}}" target="_blank">View on GitHub</a>
</div>
</nav>
<div class="main-content">
<header class="repo-header">
<h1>{{.RepoFullName}}</h1>
<div class="repo-description">{{.Description}}</div>
<div class="repo-stats">
{{if .CommitCount}}
<div class="repo-stat">
<span>📝</span> <span>{{.CommitCount}} commits</span>
</div>
{{end}}
<div class="repo-stat">
<span>📅</span> <span>Last updated: {{.LastUpdate}}</span>
</div>
{{if .License}}
<div class="repo-stat">
<span>📜</span> <span>{{.License}}</span>
</div>
{{end}}
</div>
</header>
<main>
{{if .ReadmeHTML}}
<section id="readme" class="repo-section">
<h2>README</h2>
<div class="readme-content">
{{.ReadmeHTML}}
</div>
</section>
{{end}}
{{if .Contributors}}
<section id="contributors" class="repo-section">
<h2>Top Contributors</h2>
<div class="contributors-list">
{{range .Contributors}}
<div class="contributor-item">
<!-- Use first letter as avatar if no image available -->
<div class="contributor-avatar">
{{if .Name}}{{slice .Name 0 1}}{{else}}?{{end}}
</div>
<div class="contributor-info">
<div class="contributor-name">
{{.Name}}
</div>
<div class="contributor-commits">
{{.Commits}} commits
</div>
</div>
</div>
{{end}}
</div>
<a href="{{.RepoURL}}/graphs/contributors" target="_blank">View all contributors on GitHub →</a>
</section>
{{end}}
</main>
<footer class="page-footer">
<p>Generated on {{.GeneratedAt}} • <a href="{{.RepoURL}}" target="_blank">View on GitHub</a></p>
</footer>
</div>
</body>
</html>