Chore: Upgrade to Laravel 12 + remove Mary and Jetstream dependencies (#141)
* docs: remove requirement for setting APP_KEY manually * optimize date picker * clean up modals * spot light working * reorganization * add lazy load * wip * remove filament * styling
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
@props([
|
||||
'id' => null,
|
||||
'darkTheme' => 'dark',
|
||||
'lightTheme' => 'light',
|
||||
'hidden' => false,
|
||||
])
|
||||
|
||||
<div class="{{ $hidden ? 'hidden' : '' }}">
|
||||
<label
|
||||
for="{{ $id }}"
|
||||
x-data="{
|
||||
theme: $persist(window.matchMedia('(prefers-color-scheme: dark)').matches ? '{{ $darkTheme }}' : '{{ $lightTheme }}').as('theme'),
|
||||
init() {
|
||||
if (this.theme == '{{ $darkTheme }}') {
|
||||
this.$refs.sun.classList.add('swap-off');
|
||||
this.$refs.moon.classList.add('swap-on');
|
||||
} else {
|
||||
this.$refs.sun.classList.add('swap-on');
|
||||
this.$refs.moon.classList.add('swap-off');
|
||||
}
|
||||
|
||||
this.setToggle()
|
||||
},
|
||||
setToggle() {
|
||||
document.documentElement.setAttribute('data-theme', this.theme)
|
||||
this.$dispatch('theme-changed', this.theme)
|
||||
},
|
||||
toggle() {
|
||||
this.theme = this.theme == '{{ $lightTheme }}' ? '{{ $darkTheme }}' : '{{ $lightTheme }}'
|
||||
this.setToggle()
|
||||
}
|
||||
}"
|
||||
{{ $attributes->class(["swap swap-rotate"]) }}
|
||||
>
|
||||
<input id="{{ $id }}" type="checkbox" class="theme-controller opacity-0" @click="toggle()" :value="theme" />
|
||||
<x-ui.icon x-ref="sun" name="o-sun" x-cloak />
|
||||
<x-ui.icon x-ref="moon" name="o-moon" x-cloak />
|
||||
</label>
|
||||
</div>
|
||||
<script>
|
||||
document.documentElement.setAttribute("data-theme", localStorage.getItem("theme")?.replaceAll("\"", ""))
|
||||
</script>
|
||||
Reference in New Issue
Block a user