Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sticky admin header #2268

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.pagination .page-item.active .page-link {
// overwrite a weird `z-index: 2` from Bootstrap,
// so it does not peak out of the sticky header
z-index: auto;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@
width: 100%;
height: 1px;
background: $color;
z-index: 0;
}

> * { // usually a <span> but we'll use an * just in case
@include padding(null 1rem);
position: relative;
background: $background;
z-index: 1;
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
.main-header {
display: flex;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: $main-header-height;
align-items: center;
padding: 15px $grid-gutter-width;
padding: 15px $grid-gutter-width 15px $width-sidebar + $grid-gutter-width;
background-color: very-light($color-3, 4);
border-bottom: 1px solid $color-border;
height: $main-header-height;

@media print { display: none }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ body {
}

.content-wrapper {
@include padding(1rem $grid-gutter-width null);
@include padding($main-header-height + $font-size-root $grid-gutter-width null);

&:not(.full-width) {
@include margin(null auto);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
@import 'spree/backend/components/list_group';
@import 'spree/backend/components/messages';
@import 'spree/backend/components/progress';
@import 'spree/backend/components/pagination';
@import 'spree/backend/components/table-filter';
@import 'spree/backend/components/navigation';
@import 'spree/backend/components/sidebar';
Expand Down
3 changes: 2 additions & 1 deletion backend/app/views/spree/layouts/admin.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

<body class="admin">
<%= render "spree/admin/shared/navigation" %>
<%= render "spree/admin/shared/header" %>
<%= render "spree/admin/shared/flash" %>
<%= render "spree/admin/shared/spinner" %>

Expand All @@ -21,6 +20,8 @@
<%= render "spree/admin/shared/sidebar" %>
</div>
</div>
<%# Has to be here because it's sticky, should sit on top of the content and using z-index is lame %>
<%= render "spree/admin/shared/header" %>

<div data-hook="admin_footer_scripts"></div>
</body>
Expand Down