UX: Improve git/code oneboxes (#30822)

This commit is contained in:
Jarek Radosz 2025-01-21 21:20:36 +01:00 committed by GitHub
parent f0d6e9758d
commit 8c31f1aa5f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 42 additions and 23 deletions

View File

@ -18,7 +18,7 @@ a > code {
code {
color: var(--primary-very-high);
background: var(--hljs-bg);
border-radius: var(--d-button-border-radius);
border-radius: var(--d-border-radius);
font-size: 0.875em;
line-height: calc((13 + 4) / 13);
}

View File

@ -109,6 +109,7 @@ aside.onebox {
header {
align-items: center;
display: flex;
line-height: var(--line-height-medium);
margin-bottom: 1em;
.d-icon {
@ -230,9 +231,8 @@ aside.onebox {
}
}
// tighten bottom margin on last para
p:last-child {
margin-bottom: 4px;
margin-bottom: 0;
}
// twitter fixes
@ -374,19 +374,24 @@ pre.onebox {
// -- Onebox Github Code Blob --
pre.onebox code ol.lines li::before {
box-sizing: border-box;
position: absolute;
display: inline-block;
width: 35px;
left: -40px;
color: #afafaf;
width: 3.5em;
left: calc(-3em + 1px);
color: var(--primary-600);
text-align: right;
padding-right: 5px;
padding-right: 0.5em;
font-size: var(--font-down-1);
line-height: var(--line-height-large);
line-height: calc((13 + 9.4) / 13); // matches the `code` line-height
content: counter(li-counter);
counter-increment: li-counter;
}
pre.onebox code ol.lines li.selected::before {
background-color: var(--highlight-bg);
}
.onebox.githubblob,
.onebox.gitlabblob {
.onebox-body h4 {
@ -397,6 +402,11 @@ pre.onebox code ol.lines li::before {
.git-blob-info {
font-size: var(--font-down-1);
line-height: var(--line-height-small);
}
pre {
margin-bottom: 0;
}
}
@ -410,26 +420,28 @@ pre.onebox code {
}
pre.onebox code li {
padding-left: 5px;
padding-left: 0.5em;
}
pre.onebox code ol.lines {
position: relative;
margin: 0 0 0 40px;
margin: 0 0 0 2.5em;
padding-left: 0.5em;
}
pre.onebox code ol.lines li {
list-style-type: none;
padding-left: 5px;
padding-left: 0.5em;
margin-left: 0;
border-left: 1px solid #cfcfcf;
border-left: 1px solid var(--primary-300);
min-height: 1.5em; //show empty li lines
white-space: pre;
width: max-content;
}
pre.onebox code li.selected {
pre.onebox code ol.lines li.selected {
background-color: var(--highlight-bg);
border-left-color: rgba(var(--primary-rgb), 0.2);
}
pre.onebox code {
@ -493,17 +505,17 @@ pre.onebox code {
.github-icon {
grid-area: icon;
align-self: center;
width: 100%;
height: 100%;
max-width: 2.15em;
margin: 0 auto;
align-self: stretch;
max-width: 1.8em;
height: auto;
justify-self: center;
fill: var(--primary-high);
}
.branches {
grid-area: branches;
font-size: var(--font-down-1);
line-height: var(--line-height-medium);
code {
word-break: break-all;
@ -527,7 +539,7 @@ pre.onebox code {
align-items: center;
flex-wrap: wrap;
width: 100%;
gap: 0.15em 1em;
gap: 0.15em 0.75em;
.lines {
font-weight: bold;
@ -555,16 +567,21 @@ pre.onebox code {
overflow-y: auto;
word-break: break-word;
font-family: var(--d-font-family--monospace);
font-size: 0.875em;
line-height: calc((13 + 4) / 13);
box-sizing: border-box;
.show-more {
font-family: var(--font-family);
// padding on right for larger hitzone
padding: 0.5em 1.5em 0 0.25em;
padding: 0.5em 1em 0 0.2em;
}
}
.onebox-avatar-inline {
border-radius: 2px;
vertical-align: text-bottom;
}
.labels span {

View File

@ -78,7 +78,7 @@
float: none;
}
.topic-post article.boxed .select-posts {
.topic-post > article.boxed .select-posts {
width: auto;
left: auto;
right: 0;

View File

@ -10,12 +10,12 @@
}
.topic-post-visited {
+ .topic-post article {
+ .topic-post > article {
border-top: none;
}
}
.topic-post article {
.topic-post > article {
border-top: 1px solid var(--primary-low);
padding: 15px 0 8px 0;
}

View File

@ -34,7 +34,9 @@ $max_image_height: 150px;
.onebox-body .aspect-image {
max-width: 50%;
}
}
.onebox:not(.githubpullrequest, .githubcommit, .githubissue) {
@container (width < 400px) {
.onebox-body {
display: flex;