-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Recipe : Adding a 3rd party Javascript package
- Loading branch information
Showing
6 changed files
with
54 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const DarkReader = require('darkreader/darkreader'); | ||
|
||
// Function used to toggle the state | ||
function toggleDarkMode() { | ||
if (DarkReader.isEnabled()) { | ||
DarkReader.disable(); | ||
localStorage.setItem('UF-DarkMode-enabled', false); | ||
} else { | ||
DarkReader.enable(); | ||
localStorage.setItem('UF-DarkMode-enabled', true); | ||
} | ||
} | ||
|
||
// Init when document is ready | ||
$(function() { | ||
// Init event listener for button | ||
$('.darkmode-btn').on( "click", function() { | ||
toggleDarkMode(); | ||
}); | ||
|
||
// Set initial state as saved in local storage | ||
const enabled = localStorage.getItem('UF-DarkMode-enabled'); | ||
if (enabled === "true") { DarkReader.enable(); } | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{% extends '@adminlte-theme/navigation/main-nav.html.twig' %} | ||
|
||
{% block secondary_nav %} | ||
<li> | ||
<a href="#" class="nav-highlight darkmode-btn"><i class="fa-regular fa-lightbulb"></i></a> | ||
</li> | ||
{{ parent() }} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{% extends '@admin-sprinkle/navigation/navbar.html.twig' %} | ||
|
||
{% block dashboard_navbar_extra %} | ||
<li> | ||
<a href="#" class="nav-highlight darkmode-btn"><i class="fa-regular fa-lightbulb"></i></a> | ||
</li> | ||
{% endblock %} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters