mirror of
https://github.com/wallabag/wallabag.git
synced 2025-06-27 16:36:00 +00:00
Extract Sticky Nav controller
This commit is contained in:
parent
2054be7bd4
commit
c9cfae11f7
4 changed files with 13 additions and 11 deletions
|
@ -22,6 +22,10 @@ export default class extends Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
click() {
|
||||||
|
this.dispatch('click');
|
||||||
|
}
|
||||||
|
|
||||||
disconnect() {
|
disconnect() {
|
||||||
this.instance.destroy();
|
this.instance.destroy();
|
||||||
}
|
}
|
||||||
|
|
7
assets/controllers/sticky_nav_controller.js
Normal file
7
assets/controllers/sticky_nav_controller.js
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
import { Controller } from '@hotwired/stimulus';
|
||||||
|
|
||||||
|
export default class extends Controller {
|
||||||
|
toggle() {
|
||||||
|
this.element.classList.toggle('entry-nav-top--sticky');
|
||||||
|
}
|
||||||
|
}
|
|
@ -129,16 +129,7 @@ import './scss/index.scss';
|
||||||
addDarkThemeListeners();
|
addDarkThemeListeners();
|
||||||
}());
|
}());
|
||||||
|
|
||||||
const stickyNav = () => {
|
|
||||||
const nav = $('.js-entry-nav-top');
|
|
||||||
$('[data-toggle="actions"]').click(() => {
|
|
||||||
nav.toggleClass('entry-nav-top--sticky');
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
$(document).ready(() => {
|
$(document).ready(() => {
|
||||||
stickyNav();
|
|
||||||
|
|
||||||
$('#nav-btn-add-tag').on('click', () => {
|
$('#nav-btn-add-tag').on('click', () => {
|
||||||
$('.nav-panel-add-tag').toggle();
|
$('.nav-panel-add-tag').toggle();
|
||||||
$('.nav-panel-menu').addClass('hidden');
|
$('.nav-panel-menu').addClass('hidden');
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<div class="progress">
|
<div class="progress">
|
||||||
<div class="determinate" data-controller="scroll-indicator" data-action="scroll@window->scroll-indicator#updateWidth"></div>
|
<div class="determinate" data-controller="scroll-indicator" data-action="scroll@window->scroll-indicator#updateWidth"></div>
|
||||||
</div>
|
</div>
|
||||||
<nav class="hide-on-large-only js-entry-nav-top">
|
<nav class="hide-on-large-only" data-controller="sticky-nav" data-action="materialize--fab:click@window->sticky-nav#toggle">
|
||||||
<div class="nav-panel-item cyan darken-1">
|
<div class="nav-panel-item cyan darken-1">
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
|
@ -338,7 +338,7 @@
|
||||||
{{ entry.content|raw }}
|
{{ entry.content|raw }}
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
<div class="fixed-action-btn horizontal click-to-toggle hide-on-large-only" data-controller="materialize--fab" data-action="scroll@window->materialize--fab#autoDisplay">
|
<div class="fixed-action-btn horizontal click-to-toggle hide-on-large-only" data-controller="materialize--fab" data-action="scroll@window->materialize--fab#autoDisplay click->materialize--fab#click">
|
||||||
<a class="btn-floating btn-large" data-toggle="actions">
|
<a class="btn-floating btn-large" data-toggle="actions">
|
||||||
<i class="material-icons">menu</i>
|
<i class="material-icons">menu</i>
|
||||||
</a>
|
</a>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue