Skip to content

Commit 265d438

Browse files
zeripathkolaentelunny
authored
fix: PR status layout on mobile (#21547) (#22441)
Backport #21547 This PR fixes the layout of PR status layouts on mobile. For longer status context names or on very small screens the text would overflow and push the "Details" and "Required" badges out of the container. Before: ![Screen Shot 2022-10-22 at 12 27 46](https://user-images.githubusercontent.com/13721712/197335454-e4decf09-4778-43e8-be88-9188fabbec23.png) After: ![Screen Shot 2022-10-22 at 12 53 24](https://user-images.githubusercontent.com/13721712/197335449-2c731a6c-7fd6-4b97-be0e-704a99fd3d32.png) Co-authored-by: kolaente <[email protected]> Co-authored-by: Lunny Xiao <[email protected]>
1 parent 93e907d commit 265d438

File tree

2 files changed

+48
-8
lines changed

2 files changed

+48
-8
lines changed

Diff for: templates/repo/pulls/status.tmpl

+10-8
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,16 @@
1818
{{end}}
1919

2020
{{range $.LatestCommitStatuses}}
21-
<div class="ui attached segment">
22-
<span>{{template "repo/commit_status" .}}</span>
23-
<span class="ui">{{.Context}} <span class="text grey">{{.Description}}</span></span>
24-
<div class="ui right">
25-
{{if $.is_context_required}}
26-
{{if (call $.is_context_required .Context)}}<div class="ui label">{{$.locale.Tr "repo.pulls.status_checks_requested"}}</div>{{end}}
27-
{{end}}
28-
<span class="ui">{{if .TargetURL}}<a href="{{.TargetURL}}">{{$.locale.Tr "repo.pulls.status_checks_details"}}</a>{{end}}</span>
21+
<div class="ui attached segment pr-status">
22+
{{template "repo/commit_status" .}}
23+
<div class="status-context">
24+
<span>{{.Context}} <span class="text grey">{{.Description}}</span></span>
25+
<div class="ui status-details">
26+
{{if $.is_context_required}}
27+
{{if (call $.is_context_required .Context)}}<div class="ui label">{{$.locale.Tr "repo.pulls.status_checks_requested"}}</div>{{end}}
28+
{{end}}
29+
<span class="ui">{{if .TargetURL}}<a href="{{.TargetURL}}">{{$.locale.Tr "repo.pulls.status_checks_details"}}</a>{{end}}</span>
30+
</div>
2931
</div>
3032
</div>
3133
{{end}}

Diff for: web_src/less/_repository.less

+38
Original file line numberDiff line numberDiff line change
@@ -3494,3 +3494,41 @@ td.blob-excerpt {
34943494
max-width: 165px;
34953495
}
34963496
}
3497+
3498+
.pr-status {
3499+
padding: 0 !important; // To clear fomantic's padding on .ui.segment elements
3500+
display: flex;
3501+
align-items: center;
3502+
3503+
.commit-status {
3504+
margin: 1em;
3505+
flex-shrink: 0;
3506+
}
3507+
3508+
.status-context {
3509+
display: flex;
3510+
justify-content: space-between;
3511+
width: 100%;
3512+
3513+
> span {
3514+
padding: 1em 0;
3515+
}
3516+
}
3517+
3518+
.status-details {
3519+
display: flex;
3520+
padding-right: .5em;
3521+
align-items: center;
3522+
justify-content: flex-end;
3523+
3524+
@media @mediaSm {
3525+
flex-direction: column;
3526+
align-items: flex-end;
3527+
justify-content: center;
3528+
}
3529+
3530+
> span {
3531+
padding-right: .5em; // To match the alignment with the "required" label
3532+
}
3533+
}
3534+
}

0 commit comments

Comments
 (0)