diff options
author | Alex Auvolat <alex@adnab.me> | 2022-01-31 11:54:22 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2022-01-31 11:54:22 +0100 |
commit | 937245b202c200e1405209c59893d459b2194d2f (patch) | |
tree | 38dc667fb81be27b3b21e5cfccbf36d5fbc8fefd /templates/partials | |
parent | 4dde9b0855ad8edf5eef72036ee788aeeb5cd775 (diff) | |
parent | e5beba07d6b9e102cc28c7474b9db0ae11ec3c79 (diff) | |
download | garagehq.deuxfleurs.fr-937245b202c200e1405209c59893d459b2194d2f.tar.gz garagehq.deuxfleurs.fr-937245b202c200e1405209c59893d459b2194d2f.zip |
Merge branch 'master' of git.deuxfleurs.fr:sptl/garage_website
Diffstat (limited to 'templates/partials')
-rw-r--r-- | templates/partials/doc/global_toc.html | 18 | ||||
-rw-r--r-- | templates/partials/doc/page_toc.html | 6 | ||||
-rw-r--r-- | templates/partials/doc/toc_script.html | 25 | ||||
-rw-r--r-- | templates/partials/shared/footer.html | 5 | ||||
-rw-r--r-- | templates/partials/shared/head.html | 13 | ||||
-rw-r--r-- | templates/partials/shared/nav.html | 24 | ||||
-rw-r--r-- | templates/partials/shared/search.html | 25 |
7 files changed, 87 insertions, 29 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..1453a69 100644 --- a/templates/partials/doc/toc_script.html +++ b/templates/partials/doc/toc_script.html @@ -1,9 +1,31 @@ -<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.screen.width >= 1280) { + 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 +64,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/footer.html b/templates/partials/shared/footer.html index de58caf..d5bd29c 100644 --- a/templates/partials/shared/footer.html +++ b/templates/partials/shared/footer.html @@ -4,8 +4,9 @@ {{ macros:: social_links( social_config=config.extra.social) }} </p> <p class="text-gray-600 py-2"> - Powered by <a href="https://www.getzola.org" target="_blank" - class="font-semibold hover:text-garage-orange">Zola</a> + Built with <a href="https://www.getzola.org" target="_blank" class="font-semibold hover:text-garage-orange">Zola</a>, + powered by <a href="{{config.base_url}}" class="font-semibold hover:text-garage-orange">Garage</a>, + hosted by <a href="https://deuxfleurs.fr" target="_blank" class="font-semibold hover:text-garage-orange">Deuxfleurs</a> </p> </div> </footer>
\ No newline at end of file diff --git a/templates/partials/shared/head.html b/templates/partials/shared/head.html index 185a97b..ca2033e 100644 --- a/templates/partials/shared/head.html +++ b/templates/partials/shared/head.html @@ -1,9 +1,6 @@ {% if config.extra.favicon.webmanifest %} <link href='{{ config.extra.favicon.webmanifest }}' rel="manifest" /> {% endif %} -{% if config.extra.favicon.safari_pinned_tab %} - <link color="#5bbad5" href='{{ config.extra.favicon.safari_pinned_tab }}' rel="mask-icon" /> -{% endif %} {% if config.extra.favicon.favicon_16x16 %} <link href='{{ config.extra.favicon.favicon_16x16 }}' rel="icon" sizes="16x16" type="image/png" /> {% endif %} @@ -13,14 +10,6 @@ {% if config.extra.favicon.apple_touch_icon %} <link href='{{ config.extra.favicon.apple_touch_icon }}' rel="apple-touch-icon" sizes="180x180" /> {% endif %} - -{% if config.extra.galleria.enabled %} - <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/galleria@1.6.1/dist/themes/folio/galleria.folio.min.css" - integrity="sha384-+rY0QD+LRnTOquDMzGa9lXU6jIwdiQuwCJQ2cdcW0qeP/0UbjQCZlXnRsUMA+9pH" crossorigin="anonymous"> -{% endif %} - -<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.4/css/all.min.css" - integrity="sha384-DyZ88mC6Up2uqS4h/KRgHuoeGwBcD4Ng9SiP4dIRy0EXTlnuz47vAwmeGwVChigm" crossorigin="anonymous"> <link href="{{ get_url(path='style.css') }}" rel="stylesheet" /> @@ -28,7 +17,7 @@ <title> {% block title %} - {{ config.title }} + {{ config.title }} - An open-source distributed storage service {% endblock title %} </title> diff --git a/templates/partials/shared/nav.html b/templates/partials/shared/nav.html index 2489bf6..a4a4b99 100644 --- a/templates/partials/shared/nav.html +++ b/templates/partials/shared/nav.html @@ -1,17 +1,21 @@ -<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"> +<nav aria-label="navigation-section" class="navbar w-full relative" role="navigation"> + <div class="w-full flex 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"> + <input type="checkbox" id="navMenuToggleBtn" value="0"/> + <label for="navMenuToggleBtn" class="md:hidden p-1.5 hover:bg-white rounded-lg hover:shadow cursor-pointer" style="margin-top:0.08rem;"> + <svg class="w-6 h-6" 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="M4 6h16M4 12h16M4 18h7"></path></svg> + </label> + <div class="hidden py-4 md:py-0 z-40 md:block absolute md:static top-12 left-0 right-0 navbar-menu bg-gray-100 shadow-md md:shadow-none md:bg-transparent" id="navMenu"> + <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 +29,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:shadow px-2 py-1.5 rounded text-white transition-all duration-500 bg-gradient-to-tl from-garage-orange via-orange-500 to-orange-300 bg-size-200 bg-pos-0 hover:bg-pos-100"> + <svg class="w-6 h-6 animate-pulse" 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 class="hidden md:inline">Download</span> + </a> </div> </div> </div> diff --git a/templates/partials/shared/search.html b/templates/partials/shared/search.html new file mode 100644 index 0000000..cb0ae2e --- /dev/null +++ b/templates/partials/shared/search.html @@ -0,0 +1,25 @@ +<section id="search-modal" class="modal hidden z-50 bg-gradient-to-b from-gray-50 to-gray-100 w-5/6 md:w-4/5 lg:w-3/4 xl:w-2/3 2xl:w-1/2 absolute top-20 left-1/2 transform -translate-x-1/2 shadow-2xl rounded-lg"> + <div class="p-2 md:p-4 xl:p-8 border-8 border-gray-300 rounded-lg shadow-inner" style="min-height:30vh;"> + <section class="relative flex flex-col items-center justify-center"> + <div class="flexs items-center justify-center"> + <span class="text-xl inline-block font-thin">Search</span> + <span class="font-normal inline-block text-xs text-gray-500">(alt + S)</span> + </div> + <div class="field mt-8 md:mt-0 mb-2"> + <div class="control"> + <input + id="search" + class="p-2 md:p-4 shadow rounded-lg outline-2 focus:outline outline-garage-orange" + placeholder="Search on Garage..." type="search" /> + </div> + </div> + <div class="search-results hidden mt-8 p-2 md:p-4 w-full bg-white rounded shadow"> + <div class="search-results__items max-h-96 overflow-y-scroll p-2 md:p-4 focus:outline outline-garage-orange"></div> + </div> + </section> + <button aria-label="close" id="close-modal-btn" class="absolute top-4 right-4 flex items-center group rounded-full shadow-inner bg-gray-300 border border-transparent hover:border-gray-500 bg-opacity-50 p-2"> + <svg id="close-modal-btn-icon" class="w-6 h-6 text-gray-400" 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="M6 18L18 6M6 6l12 12"></path></svg> + <small class="text-xs text-gray-400">(Esc)</small> + </button> + </div> +</section>
\ No newline at end of file |