Skip to content

Commit cd5c067

Browse files
kolaentelunny
andauthored
fix: PR status layout on mobile (#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: Lunny Xiao <[email protected]>
1 parent 5f0cbb3 commit cd5c067

File tree

2 files changed

+48
-8
lines changed

2 files changed

+48
-8
lines changed

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}}

web_src/less/_repository.less

+38
Original file line numberDiff line numberDiff line change
@@ -3477,3 +3477,41 @@ td.blob-excerpt {
34773477
max-width: 165px;
34783478
}
34793479
}
3480+
3481+
.pr-status {
3482+
padding: 0 !important; // To clear fomantic's padding on .ui.segment elements
3483+
display: flex;
3484+
align-items: center;
3485+
3486+
.commit-status {
3487+
margin: 1em;
3488+
flex-shrink: 0;
3489+
}
3490+
3491+
.status-context {
3492+
display: flex;
3493+
justify-content: space-between;
3494+
width: 100%;
3495+
3496+
> span {
3497+
padding: 1em 0;
3498+
}
3499+
}
3500+
3501+
.status-details {
3502+
display: flex;
3503+
padding-right: .5em;
3504+
align-items: center;
3505+
justify-content: flex-end;
3506+
3507+
@media @mediaSm {
3508+
flex-direction: column;
3509+
align-items: flex-end;
3510+
justify-content: center;
3511+
}
3512+
3513+
> span {
3514+
padding-right: .5em; // To match the alignment with the "required" label
3515+
}
3516+
}
3517+
}

0 commit comments

Comments
 (0)