chore(deps): added adminlte vendored items
(this might not be entirely necessary unless we're changing everything adminlte publishes) Signed-off-by: miguel456 <me@nogueira.codes>
This commit is contained in:
65
resources/views/vendor/adminlte/components/layout/navbar-darkmode-widget.blade.php
vendored
Normal file
65
resources/views/vendor/adminlte/components/layout/navbar-darkmode-widget.blade.php
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
{{-- Navbar darkmode widget --}}
|
||||
|
||||
<li class="nav-item adminlte-darkmode-widget">
|
||||
|
||||
<a class="nav-link" href="#" role="button">
|
||||
<i class="{{ $makeIconClass() }}"></i>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
{{-- Add Javascript listener for the click event --}}
|
||||
|
||||
@once
|
||||
@push('js')
|
||||
<script>
|
||||
|
||||
$(() => {
|
||||
|
||||
const body = document.querySelector('body');
|
||||
const widget = document.querySelector('li.adminlte-darkmode-widget');
|
||||
const widgetIcon = widget.querySelector('i');
|
||||
|
||||
// Get the set of classes to be toggled on the widget icon.
|
||||
|
||||
const iconClasses = [
|
||||
...@json($makeIconEnabledClass()),
|
||||
...@json($makeIconDisabledClass())
|
||||
];
|
||||
|
||||
// Add 'click' event listener for the darkmode widget.
|
||||
|
||||
widget.addEventListener('click', () => {
|
||||
|
||||
// Toggle dark-mode class on the body tag.
|
||||
|
||||
body.classList.toggle('dark-mode');
|
||||
|
||||
// Toggle the classes on the widget icon.
|
||||
|
||||
iconClasses.forEach((c) => widgetIcon.classList.toggle(c));
|
||||
|
||||
// Notify the server. The server will be in charge to persist
|
||||
// the dark mode configuration over multiple request.
|
||||
|
||||
const fetchCfg = {
|
||||
headers: {'X-CSRF-TOKEN': '{{ csrf_token() }}'},
|
||||
method: 'POST',
|
||||
};
|
||||
|
||||
fetch(
|
||||
"{{ route('adminlte.darkmode.toggle') }}",
|
||||
fetchCfg
|
||||
)
|
||||
.catch((error) => {
|
||||
console.log(
|
||||
'Failed to notify server that dark mode was toggled',
|
||||
error
|
||||
);
|
||||
});
|
||||
});
|
||||
})
|
||||
|
||||
</script>
|
||||
@endpush
|
||||
@endonce
|
Reference in New Issue
Block a user