Skip to content

Commit 5fc6498

Browse files
committed
Improve diff side-by-side on smaller screens
1 parent af2c762 commit 5fc6498

File tree

2 files changed

+35
-66
lines changed

2 files changed

+35
-66
lines changed

src/UnisonShare/Page/ProjectContributionChangesPage.elm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import Code.Hash as Hash
77
import Code.Perspective as Perspective
88
import Code.Syntax as Syntax
99
import Code.Syntax.SyntaxConfig as SyntaxConfig
10-
import Html exposing (Html, br, code, div, h2, p, pre, span, strong, text)
10+
import Html exposing (Html, br, code, div, h2, label, p, pre, span, strong, text)
1111
import Html.Attributes exposing (class, id)
1212
import Http
1313
import Lib.HttpApi as HttpApi exposing (HttpResult)
@@ -286,7 +286,7 @@ viewChangeBadge changeLine =
286286
, class (String.toLower type_)
287287
]
288288
[ Icon.view (changeIcon changeLine)
289-
, text type_
289+
, label [] [ text type_ ]
290290
]
291291
]
292292

src/css/unison-share/page/project-contribution-changes-page.css

Lines changed: 33 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,23 @@
1616
.project-contribution-changes-page {
1717
display: flex;
1818
flex-direction: column;
19-
gap: 1.5rem;
19+
gap: 1rem;
2020

2121
& .branch-diff-content {
2222
display: flex;
2323
flex-direction: column;
24-
gap: 1.5rem;
24+
gap: 1rem;
2525

2626
& .branch-diff-content-cards {
2727
display: flex;
2828
flex-direction: row;
29-
gap: 1.5rem;
29+
gap: 1rem;
3030
}
3131
}
3232

33-
& .change-tree {
34-
width: 18rem;
35-
padding: 1rem;
33+
& .card.change-tree {
34+
--c-card_padding: 0.5rem;
35+
width: 16rem;
3636
height: max-content;
3737
overflow-x: clip;
3838
position: relative;
@@ -197,6 +197,7 @@
197197
& .definition-change.card .diff-side-by-side {
198198
display: flex;
199199
flex-direction: row;
200+
font-size: var(--font-size-small);
200201
width: 100%;
201202
gap: 0;
202203

@@ -206,16 +207,17 @@
206207

207208
& header {
208209
background: var(--u-color_element_subdued);
209-
padding: 0.5rem 1rem;
210+
padding: 0.5rem;
210211
line-height: 1;
211212
font-size: var(--font-size-extra-small);
212213
text-transform: uppercase;
213214
font-weight: bold;
214215
color: var(--u-color_text_subdued);
216+
border-bottom: 1px solid var(--u-color_border_subdued);
215217
}
216218

217219
& code {
218-
padding: 0.5rem 1rem;
220+
padding: 0.25rem 0.5rem;
219221
}
220222
}
221223

@@ -265,36 +267,6 @@
265267
& .definition-change.card.updated .segment-change a:hover {
266268
background: var(--color-orange-3);
267269
}
268-
269-
& .definition-change.card .definition-change-details::before {
270-
content: " ";
271-
width: 0.25rem;
272-
position: absolute;
273-
top: 0;
274-
left: 0;
275-
bottom: 0;
276-
border-radius: 0 0 0 3px;
277-
}
278-
279-
& .definition-change.card.updated .definition-change-details::before {
280-
background: var(--color-orange-4);
281-
}
282-
283-
& .definition-change.card.removed .definition-change-details::before {
284-
background: var(--color-pink-4);
285-
}
286-
287-
& .definition-change.card.added .definition-change-details::before {
288-
background: var(--color-green-4);
289-
}
290-
291-
& .definition-change.card.aliased .definition-change-details::before {
292-
background: var(--color-purple-4);
293-
}
294-
295-
& .definition-change.card.renamed .definition-change-details::before {
296-
background: var(--color-blue-4);
297-
}
298270
}
299271

300272
& .icon {
@@ -532,6 +504,7 @@
532504

533505
.project-contribution-changes-page .contribution-diff_uncomputable {
534506
padding: 1.5rem;
507+
535508
& h2 {
536509
font-size: 1.25rem;
537510
display: flex;
@@ -548,10 +521,9 @@
548521
}
549522
}
550523

551-
@container (max-width: 1199px) {
524+
@container (max-width: 400px) {
552525
.project-contribution-changes-page .definition-changes {
553526
& .definition-change.card .diff-side-by-side {
554-
font-size: var(--font-size-medium);
555527
flex-direction: column;
556528
}
557529

@@ -567,28 +539,6 @@
567539
}
568540
}
569541

570-
@container (min-width: 1200px) {
571-
.diff-side-by-side {
572-
font-size: var(--font-size-small);
573-
flex-direction: row;
574-
}
575-
}
576-
577-
@container (min-width: 1260px) {
578-
.diff-side-by-side {
579-
font-size: var(--font-size-medium);
580-
flex-direction: row;
581-
}
582-
}
583-
584-
@media only screen and (--u-viewport_max-xl) {
585-
.project-contribution-changes-page {
586-
& .change-tree {
587-
width: 18rem;
588-
}
589-
}
590-
}
591-
592542
@media only screen and (--u-viewport_max-lg) {
593543
.project-contribution-changes-page {
594544
& .change-tree {
@@ -601,8 +551,20 @@
601551
.project-contribution-changes-page {
602552
& .definition-change.card {
603553
& .definition-change-header .change-line {
604-
max-width: 20rem;
605-
overflow: hidden;
554+
& .change-info .hash,
555+
& .change-info .extra-info,
556+
& .change-info .icon.arrow-right,
557+
& .change-badge label {
558+
display: none;
559+
}
560+
561+
& .change-badge_wrapper {
562+
width: auto;
563+
}
564+
565+
& .change-badge {
566+
padding: 0.25rem;
567+
}
606568
}
607569

608570
& .definition-change-details {
@@ -612,3 +574,10 @@
612574
}
613575
}
614576
}
577+
578+
@media only screen and (--u-viewport_max-sm) {
579+
:is(:is(.project-contribution-changes-page .change-line) .def-icon-anchor)
580+
.def-icon {
581+
display: none;
582+
}
583+
}

0 commit comments

Comments
 (0)