From 71b300aaa11a36176e59013253304a7648e18fd3 Mon Sep 17 00:00:00 2001 From: squidfunk Date: Thu, 26 Jan 2017 21:10:52 +0100 Subject: [PATCH] Added possibility to add tabs --- material/base.html | 6 +++- material/partials/tabs-item.html | 11 ++++++ material/partials/tabs.html | 9 +++++ scripts/lint | 2 +- src/assets/stylesheets/layout/_tabs.scss | 43 ++++++++++++++++++++++ src/base.html | 4 +++ src/partials/tabs-item.html | 46 ++++++++++++++++++++++++ src/partials/tabs.html | 32 +++++++++++++++++ 8 files changed, 151 insertions(+), 2 deletions(-) create mode 100644 material/partials/tabs-item.html create mode 100644 material/partials/tabs.html create mode 100644 src/assets/stylesheets/layout/_tabs.scss create mode 100644 src/partials/tabs-item.html create mode 100644 src/partials/tabs.html diff --git a/material/base.html b/material/base.html index d6c48d90a..905db1f59 100644 --- a/material/base.html +++ b/material/base.html @@ -31,7 +31,7 @@ {% endif %} {% endblock %} {% block libs %} - + {% endblock %} {% block fonts %} {% if config.extra.font != "none" %} @@ -82,6 +82,10 @@ {% include "partials/header.html" %} {% endblock %}
+ {% set feature = config.extra.get("feature", {}) %} + {% if feature.tabs %} + {% include "partials/tabs.html" %} + {% endif %}
{% block site_nav %} diff --git a/material/partials/tabs-item.html b/material/partials/tabs-item.html new file mode 100644 index 000000000..82061ddde --- /dev/null +++ b/material/partials/tabs-item.html @@ -0,0 +1,11 @@ +
  • + {% if nav_item.children and nav_item.children | length > 0 %} + + {{ nav_item.title }} + + {% else %} + + {{ nav_item.title }} + + {% endif %} +
  • diff --git a/material/partials/tabs.html b/material/partials/tabs.html new file mode 100644 index 000000000..92a67ce3d --- /dev/null +++ b/material/partials/tabs.html @@ -0,0 +1,9 @@ + diff --git a/scripts/lint b/scripts/lint index 51c64adc0..f83f6c9ba 100755 --- a/scripts/lint +++ b/scripts/lint @@ -28,7 +28,7 @@ if [[ ! -d `npm bin` ]]; then fi # Run ESLint -`npm bin`/eslint . +`npm bin`/eslint --max-warnings 0 . ESLINT=$? # Run Stylelint diff --git a/src/assets/stylesheets/layout/_tabs.scss b/src/assets/stylesheets/layout/_tabs.scss new file mode 100644 index 000000000..3e898ab6b --- /dev/null +++ b/src/assets/stylesheets/layout/_tabs.scss @@ -0,0 +1,43 @@ +// TODO: proof of concept - needs refactor +.md-tabs { + width: 100%; + background: mix($md-color-primary, $md-color-black, 75%); + overflow: scroll; + + &__list { + margin: 0; + margin-left: 6rem; + padding: 0; + list-style: none; + white-space: nowrap; + } + + &__item { + display: inline-block; + + // text-transform: uppercase; + } + + &__link { + display: block; + padding-right: 1.2rem; + padding-left: 1.2rem; + transition: color 0.25s; + color: $md-color-white--light; + font-size: 1.4rem; // TODO: somehow centralize + line-height: 4.8rem; + + &--active, + &:hover { + color: $md-color-white; + } + + &--active { + box-shadow: 0 -0.2rem 0 mix($md-color-accent, $md-color-white, 25) inset; + } + } +} + +.md-header { + box-shadow: none !important; +} diff --git a/src/base.html b/src/base.html index 9383f1554..4bf0afef5 100644 --- a/src/base.html +++ b/src/base.html @@ -170,6 +170,10 @@
    + {% set feature = config.extra.get("feature", {}) %} + {% if feature.tabs %} + {% include "partials/tabs.html" %} + {% endif %}
    diff --git a/src/partials/tabs-item.html b/src/partials/tabs-item.html new file mode 100644 index 000000000..4e736ba38 --- /dev/null +++ b/src/partials/tabs-item.html @@ -0,0 +1,46 @@ + + + +
  • + + + {% if nav_item.children and nav_item.children | length > 0 %} + + {{ nav_item.title }} + + + + {% else %} + + {{ nav_item.title }} + + {% endif %} +
  • diff --git a/src/partials/tabs.html b/src/partials/tabs.html new file mode 100644 index 000000000..21bd010ba --- /dev/null +++ b/src/partials/tabs.html @@ -0,0 +1,32 @@ + + + +