Default Bootstrap theme to dark mode
All checks were successful
linter / quality (pull_request) Successful in 1m22s
security / Dependency Audit (pull_request) Successful in 1m36s
security / Static Analysis (pull_request) Successful in 1m54s
tests / ci (8.4) (pull_request) Successful in 1m30s
tests / ci (8.5) (pull_request) Successful in 1m28s
All checks were successful
linter / quality (pull_request) Successful in 1m22s
security / Dependency Audit (pull_request) Successful in 1m36s
security / Static Analysis (pull_request) Successful in 1m54s
tests / ci (8.4) (pull_request) Successful in 1m30s
tests / ci (8.5) (pull_request) Successful in 1m28s
- Change default theme from light to dark for first-time visitors - Fix Alpine reactive theme toggle so icons and data-bs-theme update correctly - Remove hardcoded bg-light classes that prevented dark mode from applying - Fix broken duplicate Bootstrap bundle import in app.js
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
<!doctype html>
|
||||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}" x-data x-init="
|
||||
const saved = localStorage.getItem('theme');
|
||||
if (saved) { document.documentElement.setAttribute('data-bs-theme', saved); }
|
||||
">
|
||||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}"
|
||||
x-data="{ theme: localStorage.getItem('theme') || 'dark' }"
|
||||
x-init="$watch('theme', val => { document.documentElement.setAttribute('data-bs-theme', val); localStorage.setItem('theme', val); }); document.documentElement.setAttribute('data-bs-theme', theme);"
|
||||
:data-bs-theme="theme"
|
||||
>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
@@ -43,16 +44,11 @@
|
||||
<li class="nav-item me-2">
|
||||
<button
|
||||
class="btn btn-sm btn-outline-light"
|
||||
x-on:click="
|
||||
const current = document.documentElement.getAttribute('data-bs-theme');
|
||||
const next = current === 'dark' ? 'light' : 'dark';
|
||||
document.documentElement.setAttribute('data-bs-theme', next);
|
||||
localStorage.setItem('theme', next);
|
||||
"
|
||||
x-on:click="theme = theme === 'dark' ? 'light' : 'dark'"
|
||||
title="Toggle dark/light mode"
|
||||
>
|
||||
<span x-show="document.documentElement.getAttribute('data-bs-theme') !== 'dark'">🌙</span>
|
||||
<span x-show="document.documentElement.getAttribute('data-bs-theme') === 'dark'">☀️</span>
|
||||
<span x-show="theme !== 'dark'">🌙</span>
|
||||
<span x-show="theme === 'dark'">☀️</span>
|
||||
</button>
|
||||
</li>
|
||||
@auth
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
<!doctype html>
|
||||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
|
||||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}"
|
||||
x-data="{ theme: localStorage.getItem('theme') || 'dark' }"
|
||||
x-init="document.documentElement.setAttribute('data-bs-theme', theme);"
|
||||
:data-bs-theme="theme"
|
||||
>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
@@ -8,7 +12,7 @@
|
||||
@vite(['resources/css/app.css', 'resources/js/app.js'])
|
||||
@livewireStyles
|
||||
</head>
|
||||
<body class="bg-light">
|
||||
<body>
|
||||
{{ $slot }}
|
||||
@livewireScripts
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user