patx/gitman

Normalize vertical spacing across discussions, forms, and repository pages

Commit 49a78b8 · patx · Nov 3 at 8:31PM

Changeset
49a78b85562f83668fc1c3ba33bb8c03c034b499
Parents
35d04b502a037bf9e8afc8b15607ec98a0873b62

View source at this commit

Comments

No comments yet.

Log in to comment

Diff

diff --git a/static/styles.css b/static/styles.css
index 6fe3595..060be33 100644
--- a/static/styles.css
+++ b/static/styles.css
@@ -53,7 +53,7 @@ main.page {
   width: 100%;
   max-width: 60rem;
   margin-inline: auto;
-  padding: clamp(3rem, 9vh, 5.5rem) 24px clamp(3rem, 8vh, 5rem);
+  padding: clamp(2rem, 5vh, 3.5rem) 24px clamp(3rem, 8vh, 5rem);
 }
 
 h1, h2, h3, h4 {
@@ -76,8 +76,13 @@ a:hover { color: var(--ink); text-decoration: underline; }
   outline-offset: 2px;
 }
 
-form { display: grid; gap: .9rem; }
-label { display: grid; gap: .35rem; align-content: start; }
+form { display: grid; gap: 1.25rem; margin: 0; }
+form > :where(p, pre, .alert, .notice) { margin: 0; }
+.panel > :where(form:not(:first-child)),
+.auth-card > :where(form:not(:first-child)) { margin-top: 1.25rem; }
+.panel > .comment-form { margin-top: 2rem; }
+.auth-card > form + p { margin-top: 1.5rem; }
+label { display: grid; gap: .5rem; align-content: start; }
 
 input, textarea, select {
   width: 100%;
@@ -237,8 +242,10 @@ th { color: var(--ink); font-weight: 700; }
 }
 .nav { align-items: center; }
 .panel-heading, .repo-header { justify-content: space-between; }
-.panel-heading { margin-bottom: 1.25rem; }
-.panel-heading h2 { margin: 0; }
+.panel-heading { margin-bottom: 1.5rem; row-gap: 1rem; }
+.panel-heading h2 { margin-bottom: .5rem; }
+.panel-heading > h2, .panel-heading > :last-child,
+.panel-heading > div > :last-child { margin-bottom: 0; }
 .nav-icons {
   display: inline-flex;
   align-items: center;
@@ -268,6 +275,11 @@ th { color: var(--ink); font-weight: 700; }
 .colophon a:hover { color: var(--ink); text-decoration: underline; }
 
 .repo-header, .profile-header { margin-bottom: 2.5rem; }
+.repo-header.slim { margin-bottom: 2rem; }
+.repo-header > div > :last-child, .profile-header > :last-child { margin-bottom: 0; }
+.repo-tabs { margin-top: .5rem; row-gap: .5rem; }
+.repo-header .breadcrumb, .repo-header .repo-origin { margin-top: 1rem; }
+.repo-header .repo-tabs + p { margin-top: .75rem; }
 .repo-header { display: flex; align-items: flex-end; gap: 2rem; flex-wrap: wrap; }
 .panel { margin-bottom: 2.5rem; }
 .panel > :last-child, .repo-header > :last-child, .auth-card > :last-child { margin-bottom: 0; }
@@ -311,6 +323,11 @@ th { color: var(--ink); font-weight: 700; }
   margin: 0;
   list-style: none;
 }
+.repo-list { gap: 1.5rem; }
+.commit-list, .comment-list { gap: 1.25rem; }
+.commit-list li > div > :last-child { margin-bottom: 0; }
+.commit-list li strong, .commit-list li small { display: block; }
+.commit-list li p { margin-top: .5rem; }
 .commit-list li, .file-list li { display: grid; grid-template-columns: 8rem 1fr; gap: 1rem; }
 .commit-list li > code, .file-list li > code { justify-self: start; }
 
@@ -324,13 +341,14 @@ th { color: var(--ink); font-weight: 700; }
 .activity-title, .activity-detail { margin-bottom: .25rem; }
 .activity-detail { color: var(--text); }
 
-.comment { padding-bottom: 1rem; border-bottom: 1px solid var(--surface-border); min-width: 0; }
+.comment { padding-bottom: 1.25rem; border-bottom: 1px solid var(--surface-border); min-width: 0; }
 .comment:last-child { border-bottom: 0; padding-bottom: 0; }
 .comment-meta {
   display: flex;
-  gap: .5rem;
+  flex-wrap: wrap;
+  gap: .25rem .5rem;
   align-items: baseline;
-  margin-bottom: .35rem;
+  margin-bottom: .5rem;
 }
 .comment-body {
   line-height: 1.6;
@@ -359,7 +377,7 @@ th { color: var(--ink); font-weight: 700; }
 .markdown-body a { text-decoration: underline; }
 
 .repo-search { position: relative; width: 18rem; max-width: 100%; align-self: flex-start; }
-.repo-search-input { width: 350px; margin-bottom: 10px; }
+.repo-search-input { width: 350px; margin-bottom: 0; }
 .repo-search-form { display: block; margin: 0; }
 .panel-heading > .repo-search { margin-left: auto; }
 .hero-actions .repo-search-menu { left: 0; right: auto; }
diff --git a/templates/base.tpl b/templates/base.tpl
index eec33ec..6923443 100644
--- a/templates/base.tpl
+++ b/templates/base.tpl
@@ -11,7 +11,7 @@
   <link rel="icon" type="image/svg+xml" href="/static/git.svg">
   <link rel="stylesheet" href="/static/vendor/highlight.js/github.min.css">
   <link rel="stylesheet" href="/static/vendor/highlight.js/github-dark.min.css" media="(prefers-color-scheme: dark)">
-  <link rel="stylesheet" href="/static/styles.css?v=11">
+  <link rel="stylesheet" href="/static/styles.css?v=12">
 </head>
 <body>
   <header class="site-header">
diff --git a/templates/branches.tpl b/templates/branches.tpl
index 679945d..3c677dd 100644
--- a/templates/branches.tpl
+++ b/templates/branches.tpl
@@ -2,8 +2,8 @@
 
 <section class="repo-header slim">
   <div>
-    % include("repo_fork_eyebrow.tpl")
     % include("repo_title.tpl", repo=repo)
+    % include("repo_fork_eyebrow.tpl")
 
     % include("repo_nav.tpl", repo=repo, commit_count=commit_count, issue_counts=issue_counts, pr_counts=pr_counts, star_count=star_count, is_starred=is_starred, is_owner=is_owner, can_maintain=can_maintain)
       
@@ -18,7 +18,7 @@
       % for branch in branches:
         <li>
           <code>{{branch["name"]}}</code>
-          <div style="margin-bottom:20px;">
+          <div>
             <strong><a href="/{{repo['owner_username']}}/{{repo['name']}}/commits/{{branch['short_node']}}">{{branch["short_node"]}}</a></strong>
             <small>commit {{branch["short_node"]}} · {{branch["date"]}}</small>
             <p>{{branch["summary"]}}
diff --git a/templates/commit_detail.tpl b/templates/commit_detail.tpl
index 037f7b4..9768983 100644
--- a/templates/commit_detail.tpl
+++ b/templates/commit_detail.tpl
@@ -2,8 +2,8 @@
 
 <section class="repo-header slim">
   <div>
-    % include("repo_fork_eyebrow.tpl")
     % include("repo_title.tpl", repo=repo)
+    % include("repo_fork_eyebrow.tpl")
     
     % include("repo_nav.tpl", repo=repo, commit_count=commit_count, issue_counts=issue_counts, pr_counts=pr_counts, star_count=star_count, is_starred=is_starred, is_owner=is_owner, can_maintain=can_maintain)
 
@@ -42,7 +42,7 @@
   % end
 
   % if user:
-    <form method="post">
+    <form class="comment-form" method="post">
       {{!csrf_field()}}
       <input type="hidden" name="action" value="comment">
       <label>
diff --git a/templates/commits.tpl b/templates/commits.tpl
index 8d39215..9f502be 100644
--- a/templates/commits.tpl
+++ b/templates/commits.tpl
@@ -3,8 +3,8 @@
 
 <section class="repo-header slim">
   <div>
-    % include("repo_fork_eyebrow.tpl")
     % include("repo_title.tpl", repo=repo)
+    % include("repo_fork_eyebrow.tpl")
     
     % include("repo_nav.tpl", repo=repo, commit_count=commit_count, issue_counts=issue_counts, pr_counts=pr_counts, star_count=star_count, is_starred=is_starred, is_owner=is_owner, can_maintain=can_maintain)
 
@@ -15,7 +15,7 @@
   % if commits:
     <ul class="commit-list" data-paginated-list>
       % for commit in commits:
-        <li style="margin-bottom: 24px;">
+        <li>
           <code><a href="{{url_with_ref('/' + repo['owner_username'] + '/' + repo['name'] + '/commits/' + commit['node'], selected_ref)}}">{{commit["short_node"]}}</a></code>
           <div>
             <strong>{{commit["summary"]}}</strong>
diff --git a/templates/file.tpl b/templates/file.tpl
index 1d5c747..d0d40d5 100644
--- a/templates/file.tpl
+++ b/templates/file.tpl
@@ -2,8 +2,8 @@
 
 <section class="repo-header slim">
   <div>
-    % include("repo_fork_eyebrow.tpl")
     % include("repo_title.tpl", repo=repo)
+    % include("repo_fork_eyebrow.tpl")
     
     % include("repo_nav.tpl", repo=repo, commit_count=commit_count, issue_counts=issue_counts, pr_counts=pr_counts, star_count=star_count, is_starred=is_starred, is_owner=is_owner, can_maintain=can_maintain)
     
diff --git a/templates/index.tpl b/templates/index.tpl
index 510c12c..fee46cb 100644
--- a/templates/index.tpl
+++ b/templates/index.tpl
@@ -3,7 +3,7 @@
 <section class="panel">
   <div class="panel-heading">
     <div>
-            <p class ="eyebrow">GitMan.io: Free Git repository hosting for open source software</p>
+            <p>GitMan.io: Free Git repository hosting for open source software</p>
             % if not user:
               <div class="hero-actions">
                 <a class="button" href="/signup">Create an account</a>
diff --git a/templates/issue_detail.tpl b/templates/issue_detail.tpl
index f6173e3..02921dd 100644
--- a/templates/issue_detail.tpl
+++ b/templates/issue_detail.tpl
@@ -2,8 +2,8 @@
 
 <section class="repo-header slim">
   <div>
-    % include("repo_fork_eyebrow.tpl")
     % include("repo_title.tpl", repo=repo)
+    % include("repo_fork_eyebrow.tpl")
 
     % include("repo_nav.tpl", repo=repo, commit_count=commit_count, issue_counts=issue_counts, pr_counts=pr_counts, star_count=star_count, is_starred=is_starred, is_owner=is_owner, can_maintain=can_maintain)
 
@@ -49,7 +49,7 @@
   % end
 
   % if user:
-    <form method="post">
+    <form class="comment-form" method="post">
       {{!csrf_field()}}
       <input type="hidden" name="action" value="comment">
       <label>
diff --git a/templates/issues.tpl b/templates/issues.tpl
index fabaf29..d482276 100644
--- a/templates/issues.tpl
+++ b/templates/issues.tpl
@@ -4,8 +4,8 @@
 
 <section class="repo-header slim">
   <div>
-    % include("repo_fork_eyebrow.tpl")
     % include("repo_title.tpl", repo=repo)
+    % include("repo_fork_eyebrow.tpl")
     
     % include("repo_nav.tpl", repo=repo, commit_count=commit_count, issue_counts=issue_counts, pr_counts=pr_counts, star_count=star_count, is_starred=is_starred, is_owner=is_owner, can_maintain=can_maintain)
     
@@ -34,7 +34,7 @@
       % end
     </div>
   </div>
-  <div id="issue-search-results" style="margin-top:25px;" data-live-search-results aria-live="polite">
+  <div id="issue-search-results" data-live-search-results aria-live="polite">
     % if issues:
       <ul class="issue-list" data-paginated-list>
         % for issue in issues:
diff --git a/templates/new_issue.tpl b/templates/new_issue.tpl
index fc9c65d..7755c05 100644
--- a/templates/new_issue.tpl
+++ b/templates/new_issue.tpl
@@ -2,8 +2,8 @@
 
 <section class="repo-header slim">
   <div>
-    % include("repo_fork_eyebrow.tpl")
     % include("repo_title.tpl", repo=repo)
+    % include("repo_fork_eyebrow.tpl")
     
     % include("repo_nav.tpl", repo=repo, commit_count=commit_count, issue_counts=issue_counts, pr_counts=pr_counts, star_count=star_count, is_starred=is_starred, is_owner=is_owner, can_maintain=can_maintain)
     
diff --git a/templates/new_pull_request.tpl b/templates/new_pull_request.tpl
index 88e096b..9799307 100644
--- a/templates/new_pull_request.tpl
+++ b/templates/new_pull_request.tpl
@@ -2,8 +2,8 @@
 
 <section class="repo-header slim">
   <div>
-    % include("repo_fork_eyebrow.tpl")
     % include("repo_title.tpl", repo=repo)
+    % include("repo_fork_eyebrow.tpl")
     
     % include("repo_nav.tpl", repo=repo, commit_count=commit_count, issue_counts=issue_counts, pr_counts=pr_counts, star_count=star_count, is_starred=is_starred, is_owner=is_owner, can_maintain=can_maintain)
     
diff --git a/templates/pull_request_detail.tpl b/templates/pull_request_detail.tpl
index 0ecb377..8df5005 100644
--- a/templates/pull_request_detail.tpl
+++ b/templates/pull_request_detail.tpl
@@ -2,8 +2,8 @@
 
 <section class="repo-header slim">
   <div>
-    % include("repo_fork_eyebrow.tpl")
     % include("repo_title.tpl", repo=repo)
+    % include("repo_fork_eyebrow.tpl")
     
     % include("repo_nav.tpl", repo=repo, commit_count=commit_count, issue_counts=issue_counts, pr_counts=pr_counts, star_count=star_count, is_starred=is_starred, is_owner=is_owner, can_maintain=can_maintain)
     
@@ -56,7 +56,7 @@
   % end
 
   % if user:
-    <form method="post">
+    <form class="comment-form" method="post">
       {{!csrf_field()}}
       <input type="hidden" name="action" value="comment">
       <label>
diff --git a/templates/pull_requests.tpl b/templates/pull_requests.tpl
index d51a1d8..b100574 100644
--- a/templates/pull_requests.tpl
+++ b/templates/pull_requests.tpl
@@ -4,8 +4,8 @@
 
 <section class="repo-header slim">
   <div>
-    % include("repo_fork_eyebrow.tpl")
     % include("repo_title.tpl", repo=repo)
+    % include("repo_fork_eyebrow.tpl")
     
     % include("repo_nav.tpl", repo=repo, commit_count=commit_count, issue_counts=issue_counts, pr_counts=pr_counts, star_count=star_count, is_starred=is_starred, is_owner=is_owner, can_maintain=can_maintain)
     
@@ -35,7 +35,7 @@
       % end
     </div>
   </div>
-  <div id="pull-request-search-results" style="margin-top:25px;" data-live-search-results aria-live="polite">
+  <div id="pull-request-search-results" data-live-search-results aria-live="polite">
     % if pull_requests:
       <ul class="issue-list" data-paginated-list>
         % for pr in pull_requests:
diff --git a/templates/repo.tpl b/templates/repo.tpl
index 9c27056..5f2a499 100644
--- a/templates/repo.tpl
+++ b/templates/repo.tpl
@@ -2,8 +2,8 @@
 
 <section class="repo-header">
   <div>
-    % include("repo_fork_eyebrow.tpl")
     % include("repo_title.tpl", repo=repo)
+    % include("repo_fork_eyebrow.tpl")
 
     % include("repo_nav.tpl", repo=repo, commit_count=commit_count, issue_counts=issue_counts, pr_counts=pr_counts, star_count=star_count, is_starred=is_starred, is_owner=is_owner, can_maintain=can_maintain)
 
diff --git a/templates/repo_fork_eyebrow.tpl b/templates/repo_fork_eyebrow.tpl
index 0d7c97d..afeab35 100644
--- a/templates/repo_fork_eyebrow.tpl
+++ b/templates/repo_fork_eyebrow.tpl
@@ -1,4 +1,4 @@
 % source_repo = get("source_repo", None)
 % if source_repo:
-  <p class="eyebrow">Fork of <a href="/{{source_repo['owner_username']}}/{{source_repo['name']}}">{{source_repo["owner_username"]}}/{{source_repo["name"]}}</a>.</p>
+  <p class="repo-origin">Fork of <a href="/{{source_repo['owner_username']}}/{{source_repo['name']}}">{{source_repo["owner_username"]}}/{{source_repo["name"]}}</a>.</p>
 % end
diff --git a/templates/repo_settings.tpl b/templates/repo_settings.tpl
index c9fbff2..a20c200 100644
--- a/templates/repo_settings.tpl
+++ b/templates/repo_settings.tpl
@@ -2,8 +2,8 @@
 
 <section class="repo-header slim">
   <div>
-    % include("repo_fork_eyebrow.tpl")
     % include("repo_title.tpl", repo=repo)
+    % include("repo_fork_eyebrow.tpl")
     
     % include("repo_nav.tpl", repo=repo, commit_count=commit_count, issue_counts=issue_counts, pr_counts=pr_counts, star_count=star_count, is_starred=is_starred, is_owner=is_owner, can_maintain=can_maintain)
     
diff --git a/templates/source.tpl b/templates/source.tpl
index 8f41832..08d8894 100644
--- a/templates/source.tpl
+++ b/templates/source.tpl
@@ -2,8 +2,8 @@
 
 <section class="repo-header slim">
   <div>
-    % include("repo_fork_eyebrow.tpl")
     % include("repo_title.tpl", repo=repo)
+    % include("repo_fork_eyebrow.tpl")
     
     % include("repo_nav.tpl", repo=repo, commit_count=commit_count, issue_counts=issue_counts, pr_counts=pr_counts, star_count=star_count, is_starred=is_starred, is_owner=is_owner, can_maintain=can_maintain)
 
diff --git a/templates/tags.tpl b/templates/tags.tpl
index f1baf9f..5c78f54 100644
--- a/templates/tags.tpl
+++ b/templates/tags.tpl
@@ -3,8 +3,8 @@
 
 <section class="repo-header slim">
   <div>
-    % include("repo_fork_eyebrow.tpl")
     % include("repo_title.tpl", repo=repo)
+    % include("repo_fork_eyebrow.tpl")
 
     % include("repo_nav.tpl", repo=repo, commit_count=commit_count, issue_counts=issue_counts, pr_counts=pr_counts, star_count=star_count, is_starred=is_starred, is_owner=is_owner, can_maintain=can_maintain)
 
@@ -18,7 +18,7 @@
       % for tag in tags:
         <li>
           <code>{{tag["name"]}}</code>
-          <div style="margin-bottom:20px;">
+          <div>
             <strong><a href="/{{repo['owner_username']}}/{{repo['name']}}/commits/{{tag['short_node']}}">{{tag["short_node"]}}</a></strong>
             <small>commit {{tag["short_node"]}} · {{tag["date"]}}</small>
             <p>{{tag["summary"]}}
diff --git a/tests/test_app.py b/tests/test_app.py
index e10f201..e55073a 100644
--- a/tests/test_app.py
+++ b/tests/test_app.py
@@ -1529,7 +1529,7 @@ def test_issue_list_searches_and_paginates_results(isolated_app, monkeypatch):
     assert "Unrelated report" not in first.text
     assert 'data-live-search-form' in first.text
     assert 'data-live-search-input' in first.text
-    assert 'id="issue-search-results" style="margin-top:25px;"' in first.text
+    assert 'id="issue-search-results" data-live-search-results' in first.text
     assert 'data-paginated-list' in first.text
     assert 'data-next-url="/alice/demo/issues?q=memory&amp;page=2"' in first.text
     assert 'href="/alice/demo/issues?q=memory&amp;status=closed"' in first.text
@@ -2521,7 +2521,7 @@ def test_pull_request_list_searches_and_paginates_results(isolated_app, monkeypa
     assert "Maintenance cleanup" not in first.text
     assert 'data-live-search-form' in first.text
     assert 'data-live-search-input' in first.text
-    assert 'id="pull-request-search-results" style="margin-top:25px;"' in first.text
+    assert 'id="pull-request-search-results" data-live-search-results' in first.text
     assert 'data-paginated-list' in first.text
     assert 'data-next-url="/alice/demo/pulls?q=feature&amp;page=2"' in first.text
     assert 'href="/alice/demo/pulls?q=feature&amp;status=merged"' in first.text