-
Notifications
You must be signed in to change notification settings - Fork 3
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
Make the sidebar menu collapsible #5
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just small changes proposed but 👍
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@davidedistefano maybe we can nest the last 2 elements inside the &:checked ~ .admin-wrapper
one, something like:
#menu-button {
display: none;
&:checked ~ .admin-wrapper {
overflow: hidden;
.admin-nav {
// ...
}
.admin-content {
// ...
}
}
}
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@davidedistefano I find this part is a bit confusing (probably it already was) and I'd take advantage of this change to make a small refactor:
.admin-nav-menu {
ul {
margin: 0;
padding: 0;
list-style: none;
}
li {
background: $color-navbar-bg;
&:hover {
background: $color-navbar-active-bg;
> a {
color: $color-navbar-active;
}
}
// flyout nav
> ul {
position: absolute;
top: 0;
left: 100%;
width: $width-sidebar-flyout;
margin-left: 0;
border: $border-sidebar;
background: $color-navbar-submenu-bg;
box-shadow: $box-shadow;
@include caret($direction: left, $color-caret: $color-navbar-submenu-bg);
@include media($tablet) {
position: relative;
left: 0;
width: $width-sidebar;
border-top: 0;
border-bottom: 0;
}
&:before {
z-index: 1;
top: 1.5em;
}
}
&.selected {
background: $color-navbar-active-bg;
@include media($desktop) {
position: relative;
}
&:not(:hover) > ul {
@include media($desktop) {
display: none;
}
@include media($tablet) {
display: block;
}
}
li {
padding-left: 2em;
}
> a {
color: $color-navbar-active;
}
}
&:not(.selected) {
position: relative;
> ul {
@include media($tablet) {
display: none;
}
}
&:not(:hover) > ul {
display: none;
}
}
}
Since the flyout stuff is used just once, we can remove the flyout
mixin.
@@ -0,0 +1,16 @@ | |||
@mixin flyout { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as said above, I'd remove this mixin in favor of a better code organization.
<%= render "spree/admin/shared/spinner" %> | ||
<input type="checkbox" id="menu-button" /> | ||
|
||
<div class="admin-wrapper"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd remove the empty line under this div
@davidedistefano also, we can anticipate this PR removing all bourbon browser prefixer mixins from the new code we are writing |
@@ -28,6 +28,12 @@ | |||
.flash-wrapper { | |||
@include position(fixed, null 0 0 $width-sidebar); | |||
z-index: 1000; | |||
@include media($desktop) { | |||
@include position(fixed, null 0 0 $width-sidebar-collapsed); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can just be left: $width-sidebar-collapsed
.
@include position(fixed, null 0 0 $width-sidebar-collapsed); | ||
} | ||
@include media($desktop) { | ||
@include position(fixed, null 0 0 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly this can just be left: 0
.
@include media($tablet) { | ||
width: $width-sidebar; | ||
position: fixed; | ||
margin: 0 0 0 -200px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be -$width-sidebar
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also would prefer to use translateX()
to move it over but not too concerned about the margin.
display: none; | ||
} | ||
@include media($tablet) { | ||
display: inline-block; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's inline-block by default do we need this additional media query?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since it is not mobile first approach, we need to reset the display property.
$large-device: "only screen and (min-width: #{$tablet-width})"; | ||
$desktop: "only screen and (max-width: #{$desktop-width})"; | ||
$tablet: "only screen and (max-width: #{$tablet-width})"; | ||
$mobile: "only screen and (max-width: #{$mobile-width})"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer always going up for media queries (making sure to always use min-width). This helps create a mobile first approach:
$tablet: "screen and (min-width: 481px)";
$desktop: "screen and (min-width: 769px)";
.thing {
// default styles + mobile
style: style;
@media $tablet {
// more things
}
@media $desktop {
// more things
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@graygilmore for now we just converted the skeleton media queries set here. We internally discussed about changing them to a mobile first approach but it seemed like something not related to this PR and probably something that need a better testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 I also only just realized this wasn't a PR into Solidus itself. 🤦♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will be soon so a review at this stage is very helpful, thanks @graygilmore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not an expert on stylesheets but the CoffeeScript code looks good to me 👍
- reduce navigation width - hide the subnav on smaller screens and make it appear only on link hover - collapse the left menu only on mobile landscape
in order to avoid multiple lines and to fit right in the app header
this is needed to prevent scrolling or scrollbar to appear when the mobile menu is open
while scrolling when window height is small
- prevent jquery Sticky-kit plugin to create unnecessary divs - prevent admin nav content stick when scrolling on mobile - disable Sticky-kit on mobile - make admin nav scrollable on mobile
fd941b8
to
9b2f3e8
Compare
9b2f3e8
to
f43ceb7
Compare
will be reopened on solidus repository |
Add support for refunding payments
This PR makes the Solidus admin more usable at small screen sizes.
At medium size devices, like small desktops or big tablets, the sidebar will collapse, leaving visible only the menu icons.
At mobile screen sizes instead, the menu will only be visible by clicking on the top right hamburger menu.
To make this PR works also on devices like smartphone or tablet the following line of code should be added inside the app
<head>
element:<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
The admin layout needs some tweaks to work fine with new sidebar. I suggest to use a fluid layout instead of the old Skeleton grid.