From 37aa28f1465cfdd26a58c6dd5b752141ea876cde Mon Sep 17 00:00:00 2001 From: Joe Mou Date: Sun, 25 Jan 2026 18:51:27 -0500 Subject: Styling --- cgithub/static/style.css | 65 ++++++++++++++++++++++++++++++++++++------------ cgithub/views/blob.eta | 11 +++++++- cgithub/views/layout.eta | 18 +++++--------- cgithub/views/repo.eta | 8 +++--- 4 files changed, 69 insertions(+), 33 deletions(-) (limited to 'cgithub') diff --git a/cgithub/static/style.css b/cgithub/static/style.css index e552787..1229fce 100644 --- a/cgithub/static/style.css +++ b/cgithub/static/style.css @@ -1,33 +1,66 @@ body { - margin: 0; - padding: 1rem; + margin: 0 1rem; font-family: Helvetica, Arial, sans-serif; -} - -.icon { - height: 1lh; - vertical-align: text-bottom; -} -pre.blob { - margin: 1rem 0; - padding: 1rem; - border: 1px solid #d0d7de; - border-radius: 6px; - overflow-x: auto; - font-family: monospace; + --border-color: #d0d7de; } @media (prefers-color-scheme: dark) { body { background: #0d1117; color: #e6edf3; + --border-color: #30363d; } a { color: #4493f8; } .blob { - border-color: #30363d; background: #161b22; } } + +a { + text-decoration: none; +} + +header, .box { + margin: 1rem 0; + border: 1px solid var(--border-color); + padding: .5rem; +} + +footer { + margin-top: 1rem; + text-align: center; +} + +.icon { + height: 1lh; + vertical-align: text-bottom; +} + +.repo { + margin-bottom: 1rem; + font-size: 120%; + font-weight: bold; +} + +.branch { + display: inline-block; + margin-right: 1rem; + padding: .2rem; + border: 1px solid var(--border-color); +} + +.description { + margin-bottom: .2rem; +} + +.count + .count { + margin-left: 1rem; +} + +pre.box { + /* Instead of scrolling overflow for long lines, grow the box. */ + width: fit-content; +} diff --git a/cgithub/views/blob.eta b/cgithub/views/blob.eta index 566f5b0..9b478b5 100644 --- a/cgithub/views/blob.eta +++ b/cgithub/views/blob.eta @@ -1,3 +1,12 @@ <% layout("./layout") %> -
<%= it.rawContent %>
+
+ <% if (it.language) { %> +
language: <%= it.language %>
+ <% } %> + <% if (it.size !== undefined) { %> +
size: <%= it.size %> bytes
+ <% } %> +
+ +
<%= it.rawContent %>
diff --git a/cgithub/views/layout.eta b/cgithub/views/layout.eta index 982f8c0..a191301 100644 --- a/cgithub/views/layout.eta +++ b/cgithub/views/layout.eta @@ -2,16 +2,16 @@ - <%= it.repo.owner %>/<%= it.repo.name %> - <%= it.path || 'root' %> + <%= it.repo.owner %>/<%= it.repo.name %> - <%= it.path || '/' %>
-

<%= it.repo.owner %>/<%= it.repo.name %>

-
branch <%= it.branch %>
+
<%= it.repo.owner %>/<%= it.repo.name %>
+
branch <%= it.branch %>
<% if (it.path) { %> -
- path: root<% + + (top)<% const pathParts = it.path.split('/').filter(p => p); let currentPath = ''; for (let i = 0; i < pathParts.length; i++) { @@ -24,13 +24,7 @@ %>/<%= part %><% } } %> -
- <% } %> - <% if (it.language) { %> -
language: <%= it.language %>
- <% } %> - <% if (it.size !== undefined) { %> -
size: <%= it.size %> bytes
+ <% } %>
diff --git a/cgithub/views/repo.eta b/cgithub/views/repo.eta index 4338708..4965e75 100644 --- a/cgithub/views/repo.eta +++ b/cgithub/views/repo.eta @@ -1,7 +1,7 @@ <% layout("./layout") %> <% if (it.info) { %> -
+
<% if (it.info.description) { %>
<%= it.info.description %>
<% } %> @@ -9,13 +9,13 @@
<%= it.info.website %>
<% } %> <% if (it.info.stars) { %> - stars <%= it.info.stars %> + stars <%= it.info.stars %> <% } %> <% if (it.info.watchers) { %> - watchers <%= it.info.watchers %> + watchers <%= it.info.watchers %> <% } %> <% if (it.info.forks) { %> - forks <%= it.info.forks %> + forks <%= it.info.forks %> <% } %>
<% } %> -- cgit v1.3.1