Skip to content

Commit cdc8973

Browse files
fix[#50499]: Fix back button and title wrapping on small screen
1 parent 6db5989 commit cdc8973

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<%= render Primer::BaseComponent.new(**@system_arguments) do %>
22
<%= breadcrumbs %>
3-
<%= back_button %>
4-
<%= title %>
3+
<div class="PageHeader-titleBar">
4+
<%= back_button %>
5+
<%= title %>
6+
<%= actions %>
7+
</div>
58
<%= description %>
6-
<%= actions %>
79
<% end %>

app/components/primer/open_project/page_header.pcss

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,24 @@
55
padding-bottom: var(--stack-padding-condensed);
66
margin-bottom: var(--stack-gap-normal);
77
border-bottom: var(--borderWidth-thin) solid var(--borderColor-muted);
8-
flex-flow: row wrap;
9-
justify-content: flex-end; /* Keep actions right aligned. */
10-
align-items: baseline; /* Keep back button vertically aligned. */
8+
flex-flow: column;
119

1210
@media (max-width: 767.98px) {
1311
border-bottom: 0;
1412
}
1513
}
1614

15+
.PageHeader-titleBar {
16+
display: flex;
17+
flex-flow: row;
18+
justify-content: flex-end;
19+
align-items: baseline; /* Keep back button vertically aligned. */
20+
}
21+
1722
.PageHeader-title {
1823
font-size: 24px;
1924
font-weight: var(--base-text-weight-normal);
2025
flex: 1 1 auto;
21-
order: 0;
2226
}
2327

2428
.PageHeader-title--large {
@@ -30,15 +34,12 @@
3034
font-size: var(--text-body-size-medium);
3135
color: var(--fgColor-muted);
3236
flex: 1 100%;
33-
order: 2;
3437
}
3538

3639
/* Add 1 or 2 buttons to the right of the heading */
3740
.PageHeader-actions {
3841
margin: var(--base-size-4) 0 var(--base-size-4) var(--base-size-4);
39-
align-self: center;
4042
justify-content: flex-end;
41-
order: 1;
4243

4344
& + .PageHeader-description {
4445
margin-top: var(--base-size-4);

previews/primer/open_project/page_header_preview.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def back_button_and_breadcrumbs
5252
"test"
5353
]
5454
render(Primer::OpenProject::PageHeader.new) do |header|
55-
header.with_title() { "Hello" }
55+
header.with_title() { "Hello this is a long title for testing" }
5656
header.with_back_button(href: "#", 'aria-label': "Back")
5757
header.with_breadcrumbs(breadcrumb_items)
5858
end

previews/primer/open_project/page_header_preview/actions.html.erb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<%= render(Primer::OpenProject::PageHeader.new) do |component| %>
22
<% component.with_title(tag: :h1) do %>
3-
A title
3+
Hello this is a long title for testing
44
<% end %>
55
<% component.with_description do %>
66
A description with actions
77
<% end %>
8+
<% component.with_back_button(href: "#", 'aria-label': "Back") %>
89
<% component.with_actions do %>
910
<%= render(Primer::Alpha::ActionMenu.new) do |component| %>
1011
<% component.with_show_button { "Menu" } %>

0 commit comments

Comments
 (0)