very simple styling of the new sidebar behaviour.

I had a really hard time to understand the existing CSS which seemed
much too complicated for what it does.

Variable use was suboptimal. I couldn't figure out which variable
defines the proper size for the icon and the resulting margin.
This commit is contained in:
Andreas Gohr 2017-02-13 15:24:19 +01:00
commit 96fae1c8bc

View file

@ -4,155 +4,42 @@
* @author Jana Deutschlaender <deutschlaender@cosmocode.de> * @author Jana Deutschlaender <deutschlaender@cosmocode.de>
*/ */
#dokuwiki__aside.main-sidebar { #dokuwiki__aside.main-sidebar {
counter-reset: nav-counter;
/* + + + + + nav main + + + + + */
.nav-main { .nav-main {
> ul { @icon-size: @font-size-big;
@icon-size: @margin-default; @menu-margin: @icon-size + @margin-small*2; // FIXME this is still wrong
margin: 0 0 @margin-default; margin-left: @menu-margin; // moves *all* sidebar content to the right
padding: 0;
ul { .navi-toggle {
margin-left: (@icon-size + .5); cursor: pointer;
}
li { height: @line-height-big;
list-style-type: none; line-height: @line-height-big;
color: @color-nav;
&:first-of-type {
padding-top: .3em;
}
}
.li {
a {
display: list-item;
list-style-type: square;
color: @color-nav;
font-weight: normal; font-weight: normal;
padding-top: .1em; margin-left: (@menu-margin * -1); // moves the toggles back to the left
padding-bottom: .1em;
transition: @transition color;
&:hover,
&:focus,
&:active {
color: @button_background;
}
}
}
/* + + + first level + + + */
> li {
counter-increment: nav-counter;
position: relative;
list-style-type: none;
margin: 0;
padding: 0 0 .3em;
&:not(:last-of-type)::after {
content: '';
position: absolute;
left: 0;
bottom: 0;
display: block;
width: 100%;
height: 1px;
background-color: @color-border;
}
> .li {
position: relative;
z-index: 1;
margin-top: -1px;
padding: .5em 0 .5em (@margin-big + 1.1);
&[class="li"] {
border-bottom: solid 1px @color-border;
}
&::before {
.display-flex();
.flex-direction();
.justify-content();
content: counter(nav-counter);
position: absolute;
top: 0;
left: 0;
height: 100%;
width: @margin-big;
overflow: hidden;
color: @color-nav; color: @color-nav;
text-align: center;
margin-top: auto;
margin-bottom: auto;
}
&::after {
content: '';
position: absolute;
top: 15%;
bottom: 15%;
width: 1px;
left: (@margin-big + .5);
background-color: @color-border;
}
&.opened,
&.closed {
padding: 0;
&::before,
&::after {
display: none;
}
a {
position: relative;
display: block;
border: 1px solid transparent; border: 1px solid transparent;
border-radius: @fix_border-radius; border-radius: @fix_border-radius;
margin-bottom: -.3rem; // margin-bottom: -.3rem; FIXME
padding: .7em 0 .7em (@margin-big + 1); // padding: .7em 0 .7em (@margin-big + 1); FIXME WTF?
transition: @transition color, @transition background-color, @transition border-color; transition: @transition color, @transition background-color, @transition border-color;
&::before { span {
.display-flex(); display: inline-block;
.flex-direction(); width: @menu-margin;
.justify-content(); height: @line-height-big;
border-right: 1px solid @color-border;
content: counter(nav-counter);
position: absolute;
top: 1px;
bottom: 1px;
left: 0;
height: 100%;
width: @margin-big;
overflow: hidden;
color: @color-nav;
text-align: center; text-align: center;
margin-top: auto; margin-right: @margin-small;
margin-bottom: auto; color: @color-nav;
transition: @transition color, @transition background-color;
}
&::after { img {
content: ''; width: @icon-size;
position: absolute; height: @icon-size;
top: 15%; filter: grayscale(100%); //fixme maybe we could find a better way
bottom: 15%; }
width: 1px;
left: @margin-big;
background-color: @color-border;
transition: @transition background-color;
} }
&:hover, &:hover,
@ -163,73 +50,15 @@
color: @button_background; color: @button_background;
text-decoration: none; text-decoration: none;
&::before { span img {
color: @button_background; filter: none;
} }
&::after {
background-color: @button_background;
} }
} }
} }
} }
&.opened { // FIXME check if the stuff below is still relevant
a {
background-color: @button_background;
color: @button_color;
&::before {
background-color: @color-site-bg;
border-radius: @fix_border-radius 0 0 @fix_border-radius;
}
&::after {
display: none;
}
&:hover,
&:focus,
&:active {
background-color: @button_color;
border-color: @button_background;
color: @button_background;
text-decoration: none;
&::before {
background-color: @button_color;
color: @button_background;
}
&::after {
display: block;
background-color: @button_background;
}
}
}
+ ul {
margin-top: .5em;
margin-bottom: .25em;
}
}
+ ul {
height: auto;
overflow: hidden;
}
&.closed + ul {
height: 0;
li a{
display: none;
}
}
}
}
}
}
}
/* + + + + + + + + + + + + + + + + + + + + + + + + + + */ /* + + + + + + + + + + + + + + + + + + + + + + + + + + */
@ -259,7 +88,6 @@
} }
} }
/* + + + + + + + + + + + + + + + + + + + + + + + + + + */ /* + + + + + + + + + + + + + + + + + + + + + + + + + + */
/* max-width: 1199px */ /* max-width: 1199px */