From d4fc25b735555cb53175dba88df258834ba650fb Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Mon, 31 Mar 2025 09:46:58 +0800 Subject: Proper tabs on repo index --- static/style.css | 72 +++++++++++++++++++++++++++++++++------ templates/_header.tmpl | 3 +- templates/repo_commit.tmpl | 32 +++++++++++++++++ templates/repo_contrib_index.tmpl | 32 +++++++++++++++++ templates/repo_contrib_one.tmpl | 32 +++++++++++++++++ templates/repo_index.tmpl | 20 ++++++----- templates/repo_log.tmpl | 51 ++++++++++++++++----------- templates/repo_raw_dir.tmpl | 15 ++++++-- templates/repo_tree_dir.tmpl | 17 +++++++-- templates/repo_tree_file.tmpl | 17 +++++++-- 10 files changed, 243 insertions(+), 48 deletions(-) diff --git a/static/style.css b/static/style.css index 0776d40..ba85d3f 100644 --- a/static/style.css +++ b/static/style.css @@ -2,8 +2,16 @@ * SPDX-License-Identifier: AGPL-3.0-only * SPDX-FileContributor: Runxi Yu * SPDX-FileContributor: luk3yx + * SPDX-FileContributor: Drew DeVault + * + * Drew did not directly contribute here but we took significant portions of + * SourceHut's CSS. */ +* { + box-sizing: border-box; +} + /* Base styles and variables */ html { font-family: sans-serif; @@ -90,14 +98,8 @@ footer a:link, footer a:visited { color: inherit; } -/* Padding containers */ -.padding-wrapper { - margin: 1rem auto; - max-width: 60rem; - padding: 0 5px; -} .padding { - padding: 0 5px; + padding: 0 1rem; } /* Link styles */ @@ -351,7 +353,8 @@ header#main-header { align-items: center; justify-content: space-between; flex-wrap: wrap; - padding: 0.625rem 1rem; + padding-top: 1rem; + padding-bottom: 1rem; gap: 0.5rem; } #main-header a, #main-header a:link, main-header a:visited { @@ -501,15 +504,19 @@ td > ul { flex-wrap: nowrap; padding: 0; border-bottom: 0.25rem var(--darker-box-background-color) solid; + width: 100%; + max-width: 100%; + min-width: 100%; } -.nav-tabs-standalone li { +.nav-tabs-standalone > li { align-self: flex-end; +} +.nav-tabs-standalone > li > a { padding: 0 1rem; } -.nav-item.active { - font-weigt: bold; +.nav-item a.active { background-color: var(--darker-box-background-color); } @@ -517,3 +524,46 @@ td > ul { text-decoration: none; color: inherit; } + +.repo-header-extension { + margin-bottom: 1rem; + background-color: var(--darker-box-background-color); +} + +.repo-header > h2 { + display: inline; + margin: 0; + padding-right: 1rem; +} + +.repo-header > .nav-tabs-standalone { + border: none; + margin: 0; + flex-grow: 1; + display: inline-flex; + flex-wrap: nowrap; + padding: 0; +} + +.repo-header { + display: flex; + flex-wrap: nowrap; +} + +.repo-header-extension-content { + padding-top: 0.3rem; + padding-bottom: 0.2rem; +} + +.repo-header, .padding-wrapper, .repo-header-extension-content, #main-header { + padding-left: 1rem; + padding-right: 1rem; + max-width: 60rem; + width: 100%; + margin-left: auto; + margin-right: auto; +} + +.padding-wrapper { + margin-bottom: 1rem; +} diff --git a/templates/_header.tmpl b/templates/_header.tmpl index e0d69e4..3fe483a 100644 --- a/templates/_header.tmpl +++ b/templates/_header.tmpl @@ -13,7 +13,8 @@ {{- $dir_mode := .dir_mode -}} {{- $ref_type := .ref_type -}} {{- $ref := .ref_name -}} - {{- range $i, $segment := .url_segments -}} + {{- range $i := .separator_index -}} + {{- $segment := index $url_segments $i -}} {{- $path = printf "%s/%s" $path $segment -}} / {{ $segment }} diff --git a/templates/repo_commit.tmpl b/templates/repo_commit.tmpl index 4265f39..be71211 100644 --- a/templates/repo_commit.tmpl +++ b/templates/repo_commit.tmpl @@ -3,6 +3,7 @@ SPDX-FileContributor: Runxi Yu */}} {{- define "repo_commit" -}} +{{- $root := . -}} @@ -11,6 +12,37 @@ {{- template "header" . -}} +
+

{{- .repo_name -}}

+ +
+
+
+ {{- .repo_description -}} +
+
diff --git a/templates/repo_contrib_index.tmpl b/templates/repo_contrib_index.tmpl index 81fdb1a..671e0d3 100644 --- a/templates/repo_contrib_index.tmpl +++ b/templates/repo_contrib_index.tmpl @@ -3,6 +3,7 @@ SPDX-FileContributor: Runxi Yu */}} {{- define "repo_contrib_index" -}} +{{- $root := . -}} @@ -11,6 +12,37 @@ {{- template "header" . -}} +
+

{{- .repo_name -}}

+ +
+
+
+ {{- .repo_description -}} +
+
diff --git a/templates/repo_contrib_one.tmpl b/templates/repo_contrib_one.tmpl index 640855a..8e10e9b 100644 --- a/templates/repo_contrib_one.tmpl +++ b/templates/repo_contrib_one.tmpl @@ -3,6 +3,7 @@ SPDX-FileContributor: Runxi Yu */}} {{- define "repo_contrib_one" -}} +{{- $root := . -}} @@ -11,6 +12,37 @@ {{- template "header" . -}} +
+

{{- .repo_name -}}

+ +
+
+
+ {{- .repo_description -}} +
+
diff --git a/templates/repo_index.tmpl b/templates/repo_index.tmpl index 6db5b05..d07ebf5 100644 --- a/templates/repo_index.tmpl +++ b/templates/repo_index.tmpl @@ -12,10 +12,11 @@ {{- template "header" . -}} -
+
+

{{- .repo_name -}}

+
+
+ {{- .repo_description -}} +
+
@@ -75,11 +84,6 @@
-
-

- Merge requests -

-
{{- if .commits -}}
diff --git a/templates/repo_log.tmpl b/templates/repo_log.tmpl index b8f3563..08dd0ed 100644 --- a/templates/repo_log.tmpl +++ b/templates/repo_log.tmpl @@ -12,26 +12,37 @@ {{- template "header" . -}} - +
+

{{- .repo_name -}}

+ +
+
+
+ {{- .repo_description -}} +
+
diff --git a/templates/repo_raw_dir.tmpl b/templates/repo_raw_dir.tmpl index 1b9f59b..927101b 100644 --- a/templates/repo_raw_dir.tmpl +++ b/templates/repo_raw_dir.tmpl @@ -12,13 +12,14 @@ {{- template "header" . -}} -
+
+

{{- .repo_name -}}

+
+
+
+ {{- .repo_description -}} +
+
+
diff --git a/templates/repo_tree_dir.tmpl b/templates/repo_tree_dir.tmpl index cf94203..bc7279a 100644 --- a/templates/repo_tree_dir.tmpl +++ b/templates/repo_tree_dir.tmpl @@ -12,13 +12,14 @@ {{- template "header" . -}} -
+
+

{{- .repo_name -}}

+
+
+
+ {{- .repo_description -}} +
+
+
diff --git a/templates/repo_tree_file.tmpl b/templates/repo_tree_file.tmpl index aa1c020..56159aa 100644 --- a/templates/repo_tree_file.tmpl +++ b/templates/repo_tree_file.tmpl @@ -13,13 +13,14 @@ {{- template "header" . -}} -
+
+

{{- .repo_name -}}

+
+
+
+ {{- .repo_description -}} +
+
+

/{{ .path_spec }} (raw)

-- cgit v1.2.3