Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add fixed menu

Krzysztof Białogłowiczdbda311792d1
diff --git a/saleor/static/js/dashboard.js b/saleor/static/js/dashboard.js
index 5102df953e..7582255174 100644
--- a/saleor/static/js/dashboard.js
+++ b/saleor/static/js/dashboard.js
@@ -39,6 +39,17 @@ function openModal() {
}
$(document).ready(function() {
+
+ let styleGuideMenu = $('.styleguide__menu');
+
+ $(window).scroll(function () {
+ if ($(this).scrollTop() > 100) {
+ styleGuideMenu.addClass("fixed");
+ } else {
+ styleGuideMenu.removeClass("fixed");
+ }
+ })
+
let mainNavTop = $('.side-nav');
let $toggleMenu = $('#toggle-menu');
function toggleMenu(e) {
diff --git a/saleor/static/scss/dashboard/layouts/_style-guide.scss b/saleor/static/scss/dashboard/layouts/_style-guide.scss
index 46d4d00f53..ac88830080 100644
--- a/saleor/static/scss/dashboard/layouts/_style-guide.scss
+++ b/saleor/static/scss/dashboard/layouts/_style-guide.scss
@@ -21,22 +21,24 @@
}
&__menu {
position: relative;
- ul {
- li {
- padding: 5px 20px;
- a {
- color: $sidenav-font-color;
- display: block;
- &:hover {
- color: darken($sidenav-font-color, 20%);
- font-weight: 700;
- }
+ &.fixed {
+ position: fixed !important;
+ top: 0;
+ }
+ li {
+ padding: 5px 20px;
+ a {
+ color: $sidenav-font-color;
+ display: block;
+ &:hover {
+ color: darken($sidenav-font-color, 20%);
+ font-weight: 700;
}
- @media only screen and (max-width: $small-screen-up) {
- text-align: center;
- a {
- font-size: 1.5rem;
- }
+ }
+ @media only screen and (max-width: $small-screen-up) {
+ text-align: center;
+ a {
+ font-size: 1.5rem;
}
}
}
diff --git a/templates/dashboard/styleguide/index.html b/templates/dashboard/styleguide/index.html
index 424d26fdab..58fe218517 100644
--- a/templates/dashboard/styleguide/index.html
+++ b/templates/dashboard/styleguide/index.html
@@ -41,8 +41,8 @@
<main class="main styleguide">
<div class="container">
<div class="row">
- <div class="col m3 push-m9 s12 styleguide__menu">
- <ul>
+ <div class="col m3 push-m9 s12">
+ <ul class="styleguide__menu">
<li>
<a href="#typography">
Typography