aboutsummaryrefslogtreecommitdiff
path: root/templates/partials
diff options
context:
space:
mode:
authorsptaule <lecas83@gmail.com>2022-01-27 18:10:37 +0100
committersptaule <lecas83@gmail.com>2022-01-27 18:10:37 +0100
commit1da8b90340235753b935a880d797cb796700d151 (patch)
treee6c98c0999eb3b58e3ebfd72b88c4379a8fa51d0 /templates/partials
parenta8d6c4635cf4e49320ebee8ee6f348769b65ffa8 (diff)
downloadgaragehq.deuxfleurs.fr-1da8b90340235753b935a880d797cb796700d151.tar.gz
garagehq.deuxfleurs.fr-1da8b90340235753b935a880d797cb796700d151.zip
Doc refactor, doc and index QoL, fix search: working on every page
Diffstat (limited to 'templates/partials')
-rw-r--r--templates/partials/doc/global_toc.html18
-rw-r--r--templates/partials/doc/page_toc.html6
-rw-r--r--templates/partials/doc/toc_script.html23
-rw-r--r--templates/partials/shared/nav.html16
4 files changed, 50 insertions, 13 deletions
diff --git a/templates/partials/doc/global_toc.html b/templates/partials/doc/global_toc.html
index ebad287..f739f49 100644
--- a/templates/partials/doc/global_toc.html
+++ b/templates/partials/doc/global_toc.html
@@ -1,8 +1,20 @@
-<aside id="global_toc" class="col-span-1 h-max bg-gray-100 shadow-inner border-r border-t border-gray-200">
+<aside id="global_toc" class="relative col-span-1 h-full bg-gray-100 shadow-inner border-r border-t border-gray-200">
{% if section.subsections %}
- <ul class="space-y-2 py-0.5 px-6 py-3 list-none">
+ <ul id="main-toc-menu" class="space-y-2 px-6 py-3 list-none">
+
+ {% if section.pages %}
+ {% for page in section.pages %}
+ <a
+ href="{{ page.permalink | safe }}"
+ class="docPage block pl-2 py-1 border-l rounded-r border-garage-orange hover:bg-garage-orange hover:bg-opacity-20
+ {% if current_path == page.path %} activePage border-l-4 text-garage-orange font-semibold border-opacity-100 border-garage-orange {% endif %}">
+ {{ page.title }}
+ </a>
+ {% endfor %}
+ {% endif %}
+
{% for subsec in section.subsections %}
- {% set h1 = get_section(path=subsec) %}
+ {% set h1 = get_section(path=subsec) %}
<li class="relative">
<a
href="{{ h1.permalink | safe }}"
diff --git a/templates/partials/doc/page_toc.html b/templates/partials/doc/page_toc.html
index 172e0ce..238d8c3 100644
--- a/templates/partials/doc/page_toc.html
+++ b/templates/partials/doc/page_toc.html
@@ -1,12 +1,12 @@
-<aside class="hidden 2xl:block fixed right-0 bottom-1/2 transform translate-y-1/2 col-span-1 h-auto bg-gray-100 rounded-l-lg shadow-inner">
+<aside class="hidden 2xl:block fixed right-0 bottom-1/2 transform translate-y-1/2 w-80 col-span-1 h-auto bg-gray-100 rounded-l-lg shadow-inner">
{% if page.toc %}
<div class="w-full flex items-center justify-center py-1.5 bg-gray-200 rounded-tl-lg">
<span class="uppercase tracking-wide text-xs text-garage-gray">Page content</span>
</div>
- <ol class="text-sm space-y-0.5 py-0.5 px-8 py-3 list-decimal">
+ <ol class="text-sm space-y-0.5 px-8 py-3 list-decimal">
{% for h1 in page.toc %}
<li>
- <a href="{{ h1.permalink | safe }}" class="font-semibold bg-gradient-to-r from-garage-gray to-garage-orange text-transparent bg-clip-text transition-all hover:text-garage-orange">{{ h1.title }}</a>
+ <a href="{{ h1.permalink | safe }}" class="font-semibold text-gray-800 transition-all hover:text-garage-orange">{{ h1.title }}</a>
{% if h1.children %}
<ul class="space-y-0.5 py-0.5">
{% for h2 in h1.children %}
diff --git a/templates/partials/doc/toc_script.html b/templates/partials/doc/toc_script.html
index a858c94..df115b0 100644
--- a/templates/partials/doc/toc_script.html
+++ b/templates/partials/doc/toc_script.html
@@ -1,9 +1,29 @@
-<script type="text/javascript">
+<script>
const menuBarHeight = document.querySelector("nav.navbar").clientHeight;
+const mainTocMenuWidth = document.getElementById('main-toc-menu').clientWidth;
const tocItems = document.querySelectorAll(".toc");
const navSections = new Array(tocItems.length);
+ // Global ToC
+/*
+ Fixed ToC when user scrolls.
+*/
+
+window.addEventListener('scroll', function() {
+ if (window.scrollY >= menuBarHeight) {
+ document.getElementById('main-toc-menu').classList.add('fixed', 'top-0', 'left-0');
+ document.getElementById('main-toc-menu').style.width = mainTocMenuWidth + 'px';
+ } else {
+ document.getElementById('main-toc-menu').classList.remove('fixed', 'top-0', 'left-0');
+ }
+});
+
+// Page content
+/*
+ Focus effect on current section anchor when user scrolls.
+*/
+
tocItems.forEach((el, i) => {
let id = el.getAttribute("id").substring(5);
navSections[i] = document.getElementById(id);
@@ -42,7 +62,6 @@ window.addEventListener('scroll', () => {
}
}, false);
-// If JS enabled, deploy only the current doc menu
document.addEventListener("DOMContentLoaded", function() {
var menusTriggers = document.getElementsByClassName("deploySubMenu");
var activeDocPage = document.getElementsByClassName("activePage")[0];
diff --git a/templates/partials/shared/nav.html b/templates/partials/shared/nav.html
index 2489bf6..af46f2a 100644
--- a/templates/partials/shared/nav.html
+++ b/templates/partials/shared/nav.html
@@ -1,17 +1,17 @@
<nav aria-label="section navigation" class="navbar w-full" role="navigation">
- <div class="w-full flex flex-col space-y-2 md:space-y-0 md:flex-row items-center justify-between py-1 px-8 text-garage-gray bg-garage-orange bg-opacity-20">
+ <div class="w-full flex flex-col space-y-2 md:space-y-0 md:flex-row items-center justify-between py-1.5 px-8 text-garage-gray bg-garage-orange bg-opacity-20">
<div class="navbar-brand">
<a class="hover:rounded-full hover:bg-white" href="{{config.base_url}}">
- <img class="transform duration-150 focus:bg-white hover:bg-white hover:shadow rounded-lg hover:scale-90"
- src="{{ config.extra.organization.logo }}" width="65px">
+ <img class="px-2 transform duration-150 focus:bg-white hover:bg-white hover:shadow rounded-lg"
+ src="{{ config.extra.organization.logo_horizontal }}" width="120px">
</a>
</div>
<div class="navbar-menu" id="navMenu">
- <div class="flex items-center justify-center">
+ <div class="flex items-center justify-center space-x-2">
{% for item in config.extra.navbar_items %}
{% if lang == item.code %}
{% for nav in item.nav_items %}
- <a class="font-semibold focus:bg-white hover:bg-white hover:shadow px-4 py-2 rounded-lg"
+ <a class="font-semibold focus:bg-white hover:bg-white hover:shadow px-3 py-1 rounded-lg"
href="{{ nav.url | replace(from='$BASE_URL', to=config.base_url) }}">
{{ nav.name }}
</a>
@@ -25,6 +25,12 @@
class="focus:bg-white hover:bg-white hover:shadow px-4 py-2 rounded-lg">
<svg id="nav-search-btn-icon" class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg>
</button>
+ <a
+ href="https://garagehq.deuxfleurs.fr/_releases.html"
+ class="group flex items-center justify-center space-x-1 font-semibold shadow hover:bg-white hover:shadow px-2 py-1.5 rounded bg-orange-400 text-white hover:text-orange-400">
+ <svg class="w-6 h-6 animate-pulse group-hover:animate-bounce" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M9 19l3 3m0 0l3-3m-3 3V10"></path></svg>
+ <span>Download</span>
+ </a>
</div>
</div>
</div>