8000 feat: improve vertical sidebar with minification, theme mode and user menu when header is disabled by bastienrossi · Pull Request #2043 · tabler/tabler · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: improve vertical sidebar with minification, theme mode and user menu when header is disabled #2043

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions src/js/src/sidebar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { Tooltip } from 'bootstrap';

let sidebar = document.getElementById('sidebar');

function sidebarIsCollapsable(sidebar) {
return sidebar.classList.contains('collapse');
}

function sidebarIsCollapsed(sidebar) {
return sidebar.classList.contains('collapse') && !sidebar.classList.contains('show');
}

function createTooltip(tooltipElement, textElement) {
let options = {
delay: {show: 50, hide: 50},
html: textElement.getAttribute("data-bs-html") === "true" ?? false,
placement: textElement.getAttribute('data-bs-placement') ?? 'auto',
title: textElement.getAttribute('title') ?? textElement.textContent
};
return new Tooltip(tooltipElement, options);
}

function registerTooltips(sidebar) {
let tooltips = [];
sidebar.querySelectorAll('.nav-item .nav-link .nav-link-icon').forEach(function (navLinkIcon) {
let navLinkTitle = navLinkIcon.nextElementSibling;
tooltips.push(createTooltip(navLinkIcon, navLinkTitle));
});

sidebar.querySelectorAll('.nav-item .dropdown-menu .dropdown-item:not(.nav-link)').forEach(function (dropdownItem) {
tooltips.push(createTooltip(dropdownItem, dropdownItem));
});
return tooltips;
}

function toggleTooltips(sidebar, tooltips) {
let isCollapsed = sidebarIsCollapsed(sidebar);
tooltips.forEach(function (tooltip) {
return isCollapsed ? tooltip.enable() : tooltip.disable();
});
}

function listenSidebarCollapse(sidebar, callback) {
(new MutationObserver(function (mutations) {
mutations.forEach(function (mutation) {
callback();
});
})).observe(sidebar, {
attributes: true,
attributeFilter: ['class']
});
}

if (sidebarIsCollapsable(sidebar)) {
let tooltips = registerTooltips(sidebar);
toggleTooltips(sidebar, tooltips);
listenSidebarCollapse(sidebar, () => toggleTooltips(sidebar, tooltips));
}
1 change: 1 addition & 0 deletions src/js/tabler.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import "./src/popover"
import "./src/switch-icon"
import "./src/tab"
import "./src/toast"
import "./src/sidebar"
import * as bootstrap from "bootstrap"
import * as tabler from "./src/tabler"

Expand Down
14 changes: 9 additions & 5 deletions src/pages/_includes/layout/navbar-logo.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@
<path d="M64.6 16.2C63 9.9 58.1 5 51.8 3.4 40 1.5 28 1.5 16.2 3.4 9.9 5 5 9.9 3.4 16.2 1.5 28 1.5 40 3.4 51.8 5 58.1 9.9 63 16.2 64.6c11.8 1.9 23.8 1.9 35.6 0C58.1 63 63 58.1 64.6 51.8c1.9-11.8 1.9-23.8 0-35.6zM33.3 36.3c-2.8 4.4-6.6 8.2-11.1 11-1.5.9-3.3.9-4.8.1s-2.4-2.3-2.5-4c0-1.7.9-3.3 2.4-4.1 2.3-1.4 4.4-3.2 6.1-5.3-1.8-2.1-3.8-3.8-6.1-5.3-2.3-1.3-3-4.2-1.7-6.4s4.3-2.9 6.5-1.6c4.5 2.8 8.2 6.5 11.1 10.9 1 1.4 1 3.3.1 4.7zM49.2 46H37.8c-2.1 0-3.8-1-3.8-3s1.7-3 3.8-3h11.4c2.1 0 3.8 1 3.8 3s-1.7 3-3.8 3z" fill="#066fd1" style="fill: var(--tblr-primary, #066fd1)" />
</svg>
{% else %}
<svg xmlns="http://www.w3.org/2000/svg" width="110" height="32" viewBox="0 0 232 68" class="navbar-brand-image{% if include.show-title %} me-3{% endif %}">
<path d="M64.6 16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.3 0 2.3-.1 3.1-.4.7-.2 1.3-.5 1.8-.8.4-.3.7-.5.9-.6.6-.3 1.1-.4 1.6-.4.7 0 1.2.2 1.7.7s.7 1 .7 1.7c0 .9-.4 1.6-1.3 2.4-.9.7-2.1 1.4-3.6 1.9s-3 .8-4.6.8c-2.7 0-5-.6-7-1.7s-3.5-2.7-4.6-4.6-1.6-4.2-1.6-6.6c0-2.8.6-5.2 1.7-7.2s2.7-3.7 4.6-4.8 3.9-1.7 6-1.7 4.1.6 6 1.7 3.4 2.7 4.5 4.7c.9 1.9 1.5 4.1 1.5 6.3zm-12.2-7.5c-3.7 0-5.9 1.7-6.6 5.2h12.6v-.3c-.1-1.3-.8-2.5-2-3.5s-2.5-1.4-4-1.4zm30.3-5.2c1 0 1.8.3 2.4.8.7.5 1 1.2 1 1.9 0 1-.3 1.7-.8 2.2-.5.5-1.1.8-1.8.7-.5 0-1-.1-1.6-.3-.2-.1-.4-.1-.6-.2-.4-.1-.7-.1-1.1-.1-.8 0-1.6.3-2.4.8s-1.4 1.3-1.9 2.3-.7 2.3-.7 3.7v11.4c0 .8-.3 1.5-.8 2.1-.5.6-1.2.8-2.1.8s-1.5-.3-2.1-.8c-.5-.6-.8-1.3-.8-2.1V28.8c0-.8.3-1.5.8-2.1.5-.6 1.2-.8 2.1-.8s1.5.3 2.1.8c.5.6.8 1.3.8 2.1v.6c.7-1.3 1.8-2.3 3.2-3 1.3-.7 2.8-1 4.3-1z" fill-rule="evenodd" clip-rule="evenodd" fill="#4a4a4a"/>
</svg>

{% if include.all-size-logo %}
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 68 68" width="32" height="32" alt="{{ site.title }}" class="navbar-brand-image{% if include.show-title %} me-3{% endif %} navbar-brand-image-small">
<path d="M64.6 16.2C63 9.9 58.1 5 51.8 3.4 40 1.5 28 1.5 16.2 3.4 9.9 5 5 9.9 3.4 16.2 1.5 28 1.5 40 3.4 51.8 5 58.1 9.9 63 16.2 64.6c11.8 1.9 23.8 1.9 35.6 0C58.1 63 63 58.1 64.6 51.8c1.9-11.8 1.9-23.8 0-35.6zM33.3 36.3c-2.8 4.4-6.6 8.2-11.1 11-1.5.9-3.3.9-4.8.1s-2.4-2.3-2.5-4c0-1.7.9-3.3 2.4-4.1 2.3-1.4 4.4-3.2 6.1-5.3-1.8-2.1-3.8-3.8-6.1-5.3-2.3-1.3-3-4.2-1.7-6.4s4.3-2.9 6.5-1.6c4.5 2.8 8.2 6.5 11.1 10.9 1 1.4 1 3.3.1 4.7zM49.2 46H37.8c-2.1 0-3.8-1-3.8-3s1.7-3 3.8-3h11.4c2.1 0 3.8 1 3.8 3s-1.7 3-3.8 3z" fill="#066fd1" style="fill: var(--tblr-primary, #066fd1)" />
</svg>
{% endif %}
<svg xmlns="http://www.w3.org/2000/svg" width="110" height="32" viewBox="0 0 232 68" class="navbar-brand-image{% if include.show-title %} me-3{% endif %}{% if include.all-size-logo %} navbar-brand-image-long{% endif %}">
<path d="M64.6 16.2C63 9.9 58.1 5 51.8 3.4 40 1.5 28 1.5 16.2 3.4 9.9 5 5 9.9 3.4 16.2 1.5 28 1.5 40 3.4 51.8 5 58.1 9.9 63 16.2 64.6c11.8 1.9 23.8 1.9 35.6 0C58.1 63 63 58.1 64.6 51.8c1.9-11.8 1.9-23.8 0-35.6zM33.3 36.3c-2.8 4.4-6.6 8.2-11.1 11-1.5.9-3.3.9-4.8.1s-2.4-2.3-2.5-4c0-1.7.9-3.3 2.4-4.1 2.3-1.4 4.4-3.2 6.1-5.3-1.8-2.1-3.8-3.8-6.1-5.3-2.3-1.3-3-4.2-1.7-6.4s4.3-2.9 6.5-1.6c4.5 2.8 8.2 6.5 11.1 10.9 1 1.4 1 3.3.1 4.7zM49.2 46H37.8c-2.1 0-3.8-1-3.8-3s1.7-3 3.8-3h11.4c2.1 0 3.8 1 3.8 3s-1.7 3-3.8 3z" fill="#066fd1" style="fill: var(--tblr-primary, #066fd1)" />
<path d="M105.8 46.1c.4 0 .9.2 1.2.6s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.3-2.4.8s-1.4 1.3-1.9 2.3-.7 2.3-.7 3.7v11.4c0 .8-.3 1.5-.8 2.1-.5.6-1.2.8-2.1.8s-1.5-.3-2.1-.8c-.5-.6-.8-1.3-.8-2.1V28.8c0-.8.3-1.5.8-2.1.5-.6 1.2-.8 2.1-.8s1.5.3 2.1.8c.5.6.8 1.3.8 2.1v.6c.7-1.3 1.8-2.3 3.2-3 1.3-.7 2.8-1 4.3-1z" fill-rule="evenodd" clip-rule="evenodd" fill="#4a4a4a"/>
</svg>
{% endif %}
{% endunless %}

Expand Down
4 changes: 4 additions & 0 deletions src/pages/_includes/layout/navbar-minifier.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div class="navbar-minifier" data-bs-toggle="collapse"{% if include.target %} data-bs-target="#{{ include.target }}" aria-controls="{{ include.target }}"{% endif %} aria-expanded="true">
<span data-bs-toggle="tooltip" data-bs-placement="right" data-bs-title="Reduce">{% include ui/icon.html icon="layout-sidebar-left-collapse" class="navbar-minifier-collapse-icon" %}</span>
<span data-bs-toggle="tooltip" data-bs-placement="right" data-bs-title="Enlarge">{% include ui/icon.html icon="layout-sidebar-left-expand" class="navbar-minifier-expand-icon" %}</span>
</div>
31 changes: 2 additions & 29 deletions src/pages/_includes/layout/navbar-side.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,7 @@
{% endunless %}

<div class="d-none d-{{ include.breakpoint }}-flex">
<a href="?theme=dark" class="nav-link px-0 hide-theme-dark" title="Enable dark mode" data-bs-toggle="tooltip"
data-bs-placement="bottom">
{% include ui/icon.html icon="moon" %}
</a>

<a href="?theme=light" class="nav-link px-0 hide-theme-light" title="Enable light mode" data-bs-toggle="tooltip"
data-bs-placement="bottom">
{% include ui/icon.html icon="sun" %}
</a>
{% include layout/theme-mode.html %}

<div class="nav-item dropdown d-none d-md-flex me-3">
<a href="#" class="nav-link px-0" data-bs-toggle="dropdown" tabindex="-1" aria-label="Show notifications">
Expand All @@ -35,24 +27,5 @@
</div>
</div>

<div class="nav-item dropdown">
<a href="#" class="nav-link d-flex lh-1 text-reset p-0" data-bs-toggle="dropdown" aria-label="Open user menu">
{% include ui/avatar.html person-id=person-id size="sm" %}

{% unless include.hide-username %}
<div class="d-none d-xl-block ps-2">
<div>{{ person.full_name }}</div>
<div class="mt-1 small text-secondary">{{ person.job_title }}</div>
</div>
{% endunless %}
</a>
<div class="dropdown-menu dropdown-menu-end dropdown-menu-arrow"{% if include.dark %} data-bs-theme="light"{% endif %}>
<a href="#" class="dropdown-item">Status</a>
<a href="{{ site.base }}/profile.html" class="dropdown-item">Profile</a>
<a href="#" class="dropdown-item">Feedback</a>
<div class="dropdown-divider"></div>
<a href="{{ site.base }}/settings.html" class="dropdown-item">Settings</a>
<a href="{{ site.base }}/sign-in.html" class="dropdown-item">Logout</a>
</div>
</div>
{% include layout/navbar-user-menu.html no-padding=true auto-hide-username=true %}
</div>
20 changes: 20 additions & 0 deletions src/pages/_includes/layout/navbar-user-menu.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<div class="nav-item {% if include.direction == 'up' %}dropup{% else %}dropdown{% endif %}">
<a href="#" class="nav-link d-flex lh-1 text-reset {% if include.no-padding %}p-0{% endif %}" data-bs-toggle="dropdown" aria-label="Open user menu">
{% include ui/avatar.html person-id=person-id size="sm" %}

{% unless include.hide-username %}
<div class="nav-link-title {% if include.auto-hide-username %}d-none d-xl-block{% endif %} ps-2">
<div>{{ person.full_name }}</div>
<div class="mt-1 small text-secondary">{{ person.job_title }}</div>
</div>
{% endunless %}
</a>
<div class="dropdown-menu {% if include.direction == 'up' %}dropdown-menu-direction-top{% else %}dropdown-menu-end dropdown-menu-arrow{% endif %}"{% if include.dark %} data-bs-theme="light"{% endif %}>
<a href="#" class="dropdown-item">Status</a>
<a href="{{ site.base }}/profile.html" class="dropdown-item">Profile</a>
<a href="#" class="dropdown-item">Feedback</a>
<div class="dropdown-divider"></div>
<a href="{{ site.base }}/settings.html" class="dropdown-item">Settings</a>
<a href="{{ site.base }}/sign-in.html" class="dropdown-item">Logout</a>
</div>
</div>
17 changes: 13 additions & 4 deletions src/pages/_includes/layout/sidebar.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
{% assign breakpoint = include.breakpoint | default: 'lg' %}

<aside class="navbar navbar-vertical{% if include.right %} navbar-right{% endif %} navbar-expand-{{ breakpoint }}{% if include.transparent %} navbar-transparent{% endif %}{% if include.background %} bg-{{ include.background }}{% endif %}{% if include.class %} {{ include.class }}{% endif %}"{% if include.background-color %} style="background: {{ include.background-color }}"{% endif %}{% if include.dark %} data-bs-theme="dark"{% endif %}>
<aside id="sidebar" class="navbar navbar-vertical{% if include.right %} navbar-right{% endif %} navbar-expand-{{ breakpoint }} collapse show{% if include.transparent %} navbar-transparent{% endif %}{% if include.background %} bg-{{ include.background }}{% endif %}{% if include.class %} {{ include.class }}{% endif %}"{% if include.background-color %} style="background: {{ include.background-color }}"{% endif %}{% if include.dark %} data-bs-theme="dark"{% endif %}>
<div class="container-fluid">
{% include layout/navbar-toggler.html target="sidebar-menu" %}

{% unless include.hide-brand %}
{% include layout/navbar-logo.html breakpoint=breakpoint header=true %}
{% endunless %}
<div class="sidebar-header">
{% include layout/theme-mode.html %}

{% unless include.hide-brand %}
{% include layout/navbar-logo.html breakpoint=breakpoint header=true all-size-logo=true %}
{% endunless %}

{% include layout/navbar-minifier.html target="sidebar" %}
</div>

{% include layout/navbar-side.html class="d-lg-none" hide-username=include.hide-username person-id=include.person-id breakpoint=breakpoint %}

<div class="collapse navbar-collapse" id="sidebar-menu">
{% include layout/navbar-menu.html auto-open=true class="pt-lg-3" keep-open=true %}
<div class="navbar-nav flex-grow-0 d-none d-lg-flex">
{% include layout/navbar-user-menu.html direction="up" %}
</div>
</div>
</div>
</aside>
11 changes: 11 additions & 0 deletions src/pages/_includes/layout/theme-mode.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<span class="theme-mode nav-item">
<a href="?theme=dark" class="nav-link px-0 hide-theme-dark" title="Enable dark mode" data-bs-toggle="tooltip"
data-bs-placement="bottom">
{% include ui/icon.html icon="moon" %}
</a>

<a href="?theme=light" class="nav-link px-0 hide-theme-light" title="Enable light mode" data-bs-toggle="tooltip"
data-bs-placement="bottom">
{% include ui/icon.html icon="sun" %}
</a>
</span>
Loading
0