Fixed incorrectly displayed nested lists

This commit is contained in:
squidfunk 2017-02-26 17:06:13 +01:00 committed by Martin Donath
parent 8bf2368892
commit fc4a466346
10 changed files with 55 additions and 36 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -32,9 +32,9 @@
<script src="{{ base_url }}/assets/javascripts/modernizr-56ade86843.js"></script> <script src="{{ base_url }}/assets/javascripts/modernizr-56ade86843.js"></script>
{% endblock %} {% endblock %}
{% block styles %} {% block styles %}
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-45f91e8d31.css"> <link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-4ebe3f1d68.css">
{% if config.extra.palette %} {% if config.extra.palette %}
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-49c4a440b6.palette.css"> <link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-f6789307ff.palette.css">
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block fonts %} {% block fonts %}

View File

@ -1,5 +1,9 @@
{% set class = "md-nav__item" %}
{% if nav_item.active %}
{% set class = "md-nav__item md-nav__item--active" %}
{% endif %}
{% if nav_item.children %} {% if nav_item.children %}
<li class="md-nav__item md-nav__item--nested"> <li class="{{ class }} md-nav__item--nested">
{% if nav_item.active %} {% if nav_item.active %}
<input class="md-toggle md-nav__toggle" data-md-toggle="{{ path }}" type="checkbox" id="{{ path }}" checked> <input class="md-toggle md-nav__toggle" data-md-toggle="{{ path }}" type="checkbox" id="{{ path }}" checked>
{% else %} {% else %}
@ -23,7 +27,7 @@
</nav> </nav>
</li> </li>
{% elif nav_item == page %} {% elif nav_item == page %}
<li class="md-nav__item"> <li class="{{ class }}">
{% set toc_ = page.toc %} {% set toc_ = page.toc %}
<input class="md-toggle md-nav__toggle" data-md-toggle="toc" type="checkbox" id="toc"> <input class="md-toggle md-nav__toggle" data-md-toggle="toc" type="checkbox" id="toc">
{% if toc_ | first is defined %} {% if toc_ | first is defined %}
@ -42,15 +46,9 @@
{% endif %} {% endif %}
</li> </li>
{% else %} {% else %}
<li class="md-nav__item"> <li class="{{ class }}">
{% if nav_item.active %}
<a href="{{ nav_item.url }}" title="{{ nav_item.title }}" class="md-nav__link md-nav__link--active">
{{ nav_item.title }}
</a>
{% else %}
<a href="{{ nav_item.url }}" title="{{ nav_item.title }}" class="md-nav__link"> <a href="{{ nav_item.url }}" title="{{ nav_item.title }}" class="md-nav__link">
{{ nav_item.title }} {{ nav_item.title }}
</a> </a>
{% endif %}
</li> </li>
{% endif %} {% endif %}

View File

@ -36,6 +36,8 @@ theme_dir: material
# Options # Options
extra: extra:
feature:
tabs: true
palette: palette:
primary: indigo primary: indigo
accent: indigo accent: indigo

View File

@ -103,12 +103,21 @@ button[data-md-color-accent] {
background-color: $color; background-color: $color;
} }
// Link inside item
.md-nav__link {
// Current or hovered link // Current or hovered link
.md-nav__link:active, &:active,
.md-nav__link--active { .md-nav__item--active > & {
color: $color; color: $color;
} }
// Reset active color for nested list titles
.md-nav__item--nested > & {
color: inherit;
}
}
// [tablet portrait -]: Layered navigation // [tablet portrait -]: Layered navigation
@include break-to-device(tablet portrait) { @include break-to-device(tablet portrait) {

View File

@ -137,10 +137,15 @@
// Active link // Active link
&:active, &:active,
&--active { .md-nav__item--active > & {
color: $md-color-primary; color: $md-color-primary;
} }
// Reset active color for nested list titles
.md-nav__item--nested > & {
color: inherit;
}
// Focused or hovered link // Focused or hovered link
&:focus, &:focus,
&:hover { &:hover {

View File

@ -119,8 +119,9 @@
& > .md-nav__list > .md-nav__item { & > .md-nav__list > .md-nav__item {
font-size: 0; font-size: 0;
// Show 1st level nested items and induce margin collapse // Reset font-size for nested items and induce margin collapse
&--nested { &--nested {
display: none;
font-size: 1.4rem; font-size: 1.4rem;
overflow: auto; overflow: auto;
@ -136,6 +137,11 @@
} }
} }
} }
// Show 1st level active nested items
&--active {
display: block;
}
} }
} }

View File

@ -20,9 +20,15 @@
IN THE SOFTWARE. IN THE SOFTWARE.
--> -->
<!-- Determine class according to level -->
{% set class = "md-nav__item" %}
{% if nav_item.active %}
{% set class = "md-nav__item md-nav__item--active" %}
{% endif %}
<!-- Main navigation item with nested items --> <!-- Main navigation item with nested items -->
{% if nav_item.children %} {% if nav_item.children %}
<li class="md-nav__item md-nav__item--nested"> <li class="{{ class }} md-nav__item--nested">
<!-- Active checkbox expands items contained within nested section --> <!-- Active checkbox expands items contained within nested section -->
{% if nav_item.active %} {% if nav_item.active %}
@ -57,7 +63,7 @@
<!-- Currently active page --> <!-- Currently active page -->
{% elif nav_item == page %} {% elif nav_item == page %}
<li class="md-nav__item"> <li class="{{ class }}">
{% set toc_ = page.toc %} {% set toc_ = page.toc %}
<!-- Active checkbox expands items contained within nested section --> <!-- Active checkbox expands items contained within nested section -->
@ -88,17 +94,10 @@
<!-- Main navigation item --> <!-- Main navigation item -->
{% else %} {% else %}
<li class="md-nav__item"> <li class="{{ class }}">
{% if nav_item.active %}
<a href="{{ nav_item.url }}" title="{{ nav_item.title }}"
class="md-nav__link md-nav__link--active">
{{ nav_item.title }}
</a>
{% else %}
<a href="{{ nav_item.url }}" title="{{ nav_item.title }}" <a href="{{ nav_item.url }}" title="{{ nav_item.title }}"
class="md-nav__link"> class="md-nav__link">
{{ nav_item.title }} {{ nav_item.title }}
</a> </a>
{% endif %}
</li> </li>
{% endif %} {% endif %}