Open itsDevKay opened 1 year ago
Everything else is working properly except dark mode.
Toggle button works but the styles are reflecting. I also checked window.localStorage.getItem('dark') and it reflects the same as the demo site on vercel.
Any help? Here is my template file
Template file
<!DOCTYPE html> <html :class="{ 'theme-dark': dark }" class="max-w-full min-w-full m-0 p-0" x-data="data()" lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta id="csrf-token" data-csrf-token="{{ csrf_token() }}"> <meta id="cuuid" data-cuuid="{{ user.uuid }}"> <meta id="meta-active-tab" data-active-tab="{{ active_tab }}"> <title>{{ title }}</title> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet" /> <link rel="stylesheet" href="{{ url_for('static', filename='assets/css/tailwind.output.css') }}" /> <link rel="stylesheet" href="{{ url_for('static', filename='assets/css/toastr.min.css') }}" /> <script src="https://cdn.jsdelivr.net/gh/alpinejs/alpine@v2.x.x/dist/alpine.min.js" defer ></script> <script src="{{ url_for('static', filename='assets/js/init-alpine.js') }}"></script> {% block header %}{% endblock %} </head> <body class="max-w-full min-w-full"> <div class="flex h-screen min-w-full m-0 p-0 bg-gray-50 dark:bg-gray-900" :class="{ 'overflow-hidden': isSideMenuOpen}" > <!-- Desktop sidebar --> <aside class="z-20 hidden w-64 overflow-y-auto bg-white dark:bg-gray-800 md:block flex-shrink-0" > <div class="py-4 text-gray-500 dark:text-gray-400"> <a class="ml-6 text-lg font-bold text-gray-800 dark:text-gray-200" href="{{ url_for('dashboard') }}" > Priceless Engagments </a> <ul class="mt-6"> <li class="tab-dashboard relative px-6 py-3"> <!-- Active items have the snippet below --> <!-- <span class="absolute inset-y-0 left-0 w-1 bg-purple-600 rounded-tr-lg rounded-br-lg" aria-hidden="true" ></span> --> <!-- Add this classes to an active anchor (a tag) --> <!-- text-gray-800 dark:text-gray-100 --> <a class="inline-flex items-center w-full text-sm font-semibold transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200" href="{{ url_for('dashboard') }}" > <svg class="w-5 h-5" aria-hidden="true" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" stroke="currentColor" > <path d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6" ></path> </svg> <span class="ml-4">Dashboard</span> </a> </li> <li class="tab-settings relative px-6 py-3"> <a class="inline-flex items-center w-full text-sm font-semibold transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200" href="{{ url_for('settings') }}" > <svg fill="currentColor" viewBox="0 0 24 24" width="20" height="20" xmlns="http://www.w3.org/2000/svg" > <script xmlns="" type="text/javascript" src="moz-extension://f30e654e-f94d-ac44-abb3-95ca77ccf8bb/XMLHttpRequest.js"/> <path d="M12,8a4,4,0,1,0,4,4A4,4,0,0,0,12,8Zm0,6a2,2,0,1,1,2-2A2,2,0,0,1,12,14Zm8.99-5L19.415,9c-.008-.022-.036-.107-.046-.129l1.11-1.11a2.011,2.011,0,0,0,0-2.842l-1.4-1.4a2,2,0,0,0-1.421-.588h0a2,2,0,0,0-1.419.588L15.07,4.612,15,4.58V3.009A2.011,2.011,0,0,0,12.99,1H11.01A2.011,2.011,0,0,0,9,3.009L9,4.566l-.086.049-.043.016L7.765,3.522a2,2,0,0,0-1.42-.589h0a2,2,0,0,0-1.421.588l-1.4,1.4a2.011,2.011,0,0,0,0,2.842l1.1,1.143c-.013.029-.033.063-.043.093H3.01A2.011,2.011,0,0,0,1,11.009v1.982A2.011,2.011,0,0,0,3.01,15l1.575,0c.008.022.036.107.046.129l-1.11,1.11a2.011,2.011,0,0,0,0,2.842l1.4,1.4a2.059,2.059,0,0,0,2.842,0l1.115-1.115c.022.011.1.047.121.056v1.571A2.011,2.011,0,0,0,11.01,23h1.98A2.011,2.011,0,0,0,15,20.991l0-1.557.129-.065,1.109,1.109a2.058,2.058,0,0,0,2.843,0l1.4-1.4a2.011,2.011,0,0,0,0-2.842l-1.1-1.143c.013-.029.033-.063.043-.093H20.99A2.011,2.011,0,0,0,23,12.991V11.009A2.011,2.011,0,0,0,20.99,9Zm0,4H19.421a2.1,2.1,0,0,0-1.466,3.54l1.109,1.124-1.414,1.4-1.11-1.109A2.1,2.1,0,0,0,13,19.42L12.99,21,11,20.991V19.42a2.043,2.043,0,0,0-1.307-1.881,2.138,2.138,0,0,0-.816-.164,2,2,0,0,0-1.417.58L6.336,19.064l-1.4-1.414,1.108-1.108A2.1,2.1,0,0,0,4.579,13L3,12.991,3.01,11H4.579A2.1,2.1,0,0,0,6.045,7.46L4.936,6.336l1.414-1.4L7.46,6.045a2.04,2.04,0,0,0,2.227.419l.018-.007A2.04,2.04,0,0,0,11,4.58L11.01,3,13,3.009V4.58a2,2,0,0,0,1.227,1.845c.026.013.057.027.087.039a2.038,2.038,0,0,0,2.226-.419l1.124-1.109,1.4,1.414L17.956,7.458A2.1,2.1,0,0,0,19.421,11H20.99l.01.009Z"/> </svg> <span class="ml-4">Settings</span> </a> </li> </ul> <!-- <div class="px-6 my-6"> <button class="flex items-center justify-between w-full px-4 py-2 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-lg active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple" > Create account <span class="ml-2" aria-hidden="true">+</span> </button> </div> --> </div> </aside> <!-- Mobile sidebar --> <!-- Backdrop --> <div x-show="isSideMenuOpen" x-transition:enter="transition ease-in-out duration-150" x-transition:enter-start="opacity-0" x-transition:enter-end="opacity-100" x-transition:leave="transition ease-in-out duration-150" x-transition:leave-start="opacity-100" x-transition:leave-end="opacity-0" class="fixed inset-0 z-10 flex items-end bg-black bg-opacity-50 sm:items-center sm:justify-center" ></div> <aside class="fixed inset-y-0 z-20 flex-shrink-0 w-64 mt-16 overflow-y-auto bg-white dark:bg-gray-800 md:hidden" x-show="isSideMenuOpen" x-transition:enter="transition ease-in-out duration-150" x-transition:enter-start="opacity-0 transform -translate-x-20" x-transition:enter-end="opacity-100" x-transition:leave="transition ease-in-out duration-150" x-transition:leave-start="opacity-100" x-transition:leave-end="opacity-0 transform -translate-x-20" @click.away="closeSideMenu" @keydown.escape="closeSideMenu" > <div class="py-4 text-gray-500 dark:text-gray-400"> <a class="ml-6 text-lg font-bold text-gray-800 dark:text-gray-200" href="{{ url_for('dashboard') }}" > Priceless Engagments </a> <ul class="mt-6"> <li class="tab-dashboard-mm relative px-6 py-3"> <a class="inline-flex items-center w-full text-sm font-semibold transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200" href="{{ url_for('dashboard') }}" > <svg class="w-5 h-5" aria-hidden="true" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" stroke="currentColor" > <path d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6" ></path> </svg> <span class="ml-4">Dashboard</span> </a> </li> <li class="tab-settings-mm relative px-6 py-3"> <a class="inline-flex items-center w-full text-sm font-semibold transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200" href="{{ url_for('settings') }}" > <svg fill="currentColor" viewBox="0 0 24 24" width="20" height="20" xmlns="http://www.w3.org/2000/svg" > <script xmlns="" type="text/javascript" src="moz-extension://f30e654e-f94d-ac44-abb3-95ca77ccf8bb/XMLHttpRequest.js"/> <path d="M12,8a4,4,0,1,0,4,4A4,4,0,0,0,12,8Zm0,6a2,2,0,1,1,2-2A2,2,0,0,1,12,14Zm8.99-5L19.415,9c-.008-.022-.036-.107-.046-.129l1.11-1.11a2.011,2.011,0,0,0,0-2.842l-1.4-1.4a2,2,0,0,0-1.421-.588h0a2,2,0,0,0-1.419.588L15.07,4.612,15,4.58V3.009A2.011,2.011,0,0,0,12.99,1H11.01A2.011,2.011,0,0,0,9,3.009L9,4.566l-.086.049-.043.016L7.765,3.522a2,2,0,0,0-1.42-.589h0a2,2,0,0,0-1.421.588l-1.4,1.4a2.011,2.011,0,0,0,0,2.842l1.1,1.143c-.013.029-.033.063-.043.093H3.01A2.011,2.011,0,0,0,1,11.009v1.982A2.011,2.011,0,0,0,3.01,15l1.575,0c.008.022.036.107.046.129l-1.11,1.11a2.011,2.011,0,0,0,0,2.842l1.4,1.4a2.059,2.059,0,0,0,2.842,0l1.115-1.115c.022.011.1.047.121.056v1.571A2.011,2.011,0,0,0,11.01,23h1.98A2.011,2.011,0,0,0,15,20.991l0-1.557.129-.065,1.109,1.109a2.058,2.058,0,0,0,2.843,0l1.4-1.4a2.011,2.011,0,0,0,0-2.842l-1.1-1.143c.013-.029.033-.063.043-.093H20.99A2.011,2.011,0,0,0,23,12.991V11.009A2.011,2.011,0,0,0,20.99,9Zm0,4H19.421a2.1,2.1,0,0,0-1.466,3.54l1.109,1.124-1.414,1.4-1.11-1.109A2.1,2.1,0,0,0,13,19.42L12.99,21,11,20.991V19.42a2.043,2.043,0,0,0-1.307-1.881,2.138,2.138,0,0,0-.816-.164,2,2,0,0,0-1.417.58L6.336,19.064l-1.4-1.414,1.108-1.108A2.1,2.1,0,0,0,4.579,13L3,12.991,3.01,11H4.579A2.1,2.1,0,0,0,6.045,7.46L4.936,6.336l1.414-1.4L7.46,6.045a2.04,2.04,0,0,0,2.227.419l.018-.007A2.04,2.04,0,0,0,11,4.58L11.01,3,13,3.009V4.58a2,2,0,0,0,1.227,1.845c.026.013.057.027.087.039a2.038,2.038,0,0,0,2.226-.419l1.124-1.109,1.4,1.414L17.956,7.458A2.1,2.1,0,0,0,19.421,11H20.99l.01.009Z"/> </svg> <span class="ml-4">Settings</span> </a> </li> </ul> <!-- <div class="px-6 my-6"> <button class="flex items-center justify-between px-4 py-2 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-lg active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple" > Create account <span class="ml-2" aria-hidden="true">+</span> </button> </div> --> </div> </aside> <div class="flex flex-col flex-1 w-full"> <header class="z-10 py-4 bg-white shadow-md dark:bg-gray-800"> <div class="container flex items-center justify-between h-full px-6 mx-auto text-purple-600 dark:text-purple-300" > <!-- Mobile hamburger --> <button class="p-1 -ml-1 mr-5 rounded-md md:hidden focus:outline-none focus:shadow-outline-purple" @click="toggleSideMenu" aria-label="Menu" > <svg class="w-6 h-6" aria-hidden="true" fill="currentColor" viewBox="0 0 20 20" > <path fill-rule="evenodd" d="M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 15a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z" clip-rule="evenodd" ></path> </svg> </button> <!-- Search input --> <div class="flex flex-col items-center justify-center flex-1 lg:mr-32"> <div class="relative w-full max-w-xl mr-6 focus-within:text-purple-500" > <div class="absolute inset-y-0 flex items-center pl-2"> <svg class="w-4 h-4" aria-hidden="true" fill="currentColor" viewBox="0 0 20 20" > <path fill-rule="evenodd" d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z" clip-rule="evenodd" ></path> </svg> </div> <input class="search-input w-full py-2 pl-8 pr-2 text-sm text-gray-700 placeholder-gray-600 bg-gray-100 border-0 rounded-md dark:placeholder-gray-500 dark:focus:shadow-outline-gray dark:focus:placeholder-gray-600 dark:bg-gray-700 dark:text-gray-200 focus:placeholder-gray-500 focus:bg-white focus:border-purple-300 focus:outline-none focus:shadow-outline-purple form-input" type="text" placeholder="Search for events" aria-label="Search" data-erase-filter-on-next="0" @keyup.slash="showSearchFilterOptions" /> </div> <div class="w-full mr-6 relative" style="max-width:575px;"> <div class="filter-options-container bg-white w-full h-auto min-h-[40px] absolute shadow-md hidden"> <ul> <li class="filter-option text-sm p-1.5 hover:bg-purple-700 hover:text-white cursor-pointer">Title</li> <li class="filter-option text-sm p-1.5 hover:bg-purple-700 hover:text-white cursor-pointer">Date</li> <li class="filter-option text-sm p-1.5 hover:bg-purple-700 hover:text-white cursor-pointer">Address</li> <li class="filter-option text-sm p-1.5 hover:bg-purple-700 hover:text-white cursor-pointer">State</li> <li class="filter-option text-sm p-1.5 hover:bg-purple-700 hover:text-white cursor-pointer">Status</li> <li class="filter-option text-sm p-1.5 hover:bg-purple-700 hover:text-white cursor-pointer">Zipcode</li> </ul> </div> </div> </div> <ul class="flex items-center flex-shrink-0 space-x-6"> <!-- Theme toggler --> <li class="flex"> <button class="rounded-md focus:outline-none focus:shadow-outline-purple" @click="toggleTheme" aria-label="Toggle color mode" > <template x-if="!dark"> <svg class="w-5 h-5" aria-hidden="true" fill="currentColor" viewBox="0 0 20 20" > <path d="M17.293 13.293A8 8 0 016.707 2.707a8.001 8.001 0 1010.586 10.586z" ></path> </svg> </template> <template x-if="dark"> <svg class="w-5 h-5" aria-hidden="true" fill="currentColor" viewBox="0 0 20 20" > <path fill-rule="evenodd" d="M10 2a1 1 0 011 1v1a1 1 0 11-2 0V3a1 1 0 011-1zm4 8a4 4 0 11-8 0 4 4 0 018 0zm-.464 4.95l.707.707a1 1 0 001.414-1.414l-.707-.707a1 1 0 00-1.414 1.414zm2.12-10.607a1 1 0 010 1.414l-.706.707a1 1 0 11-1.414-1.414l.707-.707a1 1 0 011.414 0zM17 11a1 1 0 100-2h-1a1 1 0 100 2h1zm-7 4a1 1 0 011 1v1a1 1 0 11-2 0v-1a1 1 0 011-1zM5.05 6.464A1 1 0 106.465 5.05l-.708-.707a1 1 0 00-1.414 1.414l.707.707zm1.414 8.486l-.707.707a1 1 0 01-1.414-1.414l.707-.707a1 1 0 011.414 1.414zM4 11a1 1 0 100-2H3a1 1 0 000 2h1z" clip-rule="evenodd" ></path> </svg> </template> </button> </li> <!-- Notifications menu --> <li class="relative"> <button class="relative align-middle rounded-md focus:outline-none focus:shadow-outline-purple" @click="toggleNotificationsMenu" @keydown.escape="closeNotificationsMenu" aria-label="Notifications" aria-haspopup="true" > <svg class="w-5 h-5" aria-hidden="true" fill="currentColor" viewBox="0 0 20 20" > <path d="M10 2a6 6 0 00-6 6v3.586l-.707.707A1 1 0 004 14h12a1 1 0 00.707-1.707L16 11.586V8a6 6 0 00-6-6zM10 18a3 3 0 01-3-3h6a3 3 0 01-3 3z" ></path> </svg> <!-- Notification badge --> <span aria-hidden="true" class="absolute top-0 right-0 inline-block w-3 h-3 transform translate-x-1 -translate-y-1 bg-red-600 border-2 border-white rounded-full dark:border-gray-800" ></span> </button> <template x-if="isNotificationsMenuOpen"> <ul x-transition:leave="transition ease-in duration-150" x-transition:leave-start="opacity-100" x-transition:leave-end="opacity-0" @click.away="closeNotificationsMenu" @keydown.escape="closeNotificationsMenu" class="absolute right-0 w-56 p-2 mt-2 space-y-2 text-gray-600 bg-white border border-gray-100 rounded-md shadow-md dark:text-gray-300 dark:border-gray-700 dark:bg-gray-700" aria-label="submenu" > <li class="flex"> <a class="inline-flex items-center justify-between w-full px-2 py-1 text-sm font-semibold transition-colors duration-150 rounded-md hover:bg-gray-100 hover:text-gray-800 dark:hover:bg-gray-800 dark:hover:text-gray-200" href="{{ url_for('messages') }}" > <span>Messages</span> <span class="inline-flex items-center justify-center px-2 py-1 text-xs font-bold leading-none text-red-600 bg-red-100 rounded-full dark:text-red-100 dark:bg-red-600" > 13 </span> </a> </li> <li class="flex"> <a class="inline-flex items-center justify-between w-full px-2 py-1 text-sm font-semibold transition-colors duration-150 rounded-md hover:bg-gray-100 hover:text-gray-800 dark:hover:bg-gray-800 dark:hover:text-gray-200" href="{{ url_for('alerts') }}" > <span>Alerts</span> <span class="inline-flex items-center justify-center px-2 py-1 text-xs font-bold leading-none text-red-600 bg-red-100 rounded-full dark:text-red-100 dark:bg-red-600" > 2 </span> </a> </li> </ul> </template> </li> <!-- Profile menu --> <li class="relative"> <button class="align-middle rounded-full focus:shadow-outline-purple focus:outline-none" @click="toggleProfileMenu" @keydown.escape="closeProfileMenu" aria-label="Account" aria-haspopup="true" > <img class="object-cover w-8 h-8 rounded-full" src="{{ user.profile_picture }}" alt="" aria-hidden="true" /> </button> <template x-if="isProfileMenuOpen"> <ul x-transition:leave="transition ease-in duration-150" x-transition:leave-start="opacity-100" x-transition:leave-end="opacity-0" @click.away="closeProfileMenu" @keydown.escape="closeProfileMenu" class="absolute right-0 w-56 p-2 mt-2 space-y-2 text-gray-600 bg-white border border-gray-100 rounded-md shadow-md dark:border-gray-700 dark:text-gray-300 dark:bg-gray-700" aria-label="submenu" > <li class="flex"> <a class="inline-flex items-center w-full px-2 py-1 text-sm font-semibold transition-colors duration-150 rounded-md hover:bg-gray-100 hover:text-gray-800 dark:hover:bg-gray-800 dark:hover:text-gray-200" href="{{ url_for('settings') }}" > <svg class="w-4 h-4 mr-3" aria-hidden="true" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" stroke="currentColor" > <path d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z" ></path> <path d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"></path> </svg> <span>Settings</span> </a> </li> <li class="flex"> <a class="inline-flex items-center w-full px-2 py-1 text-sm font-semibold transition-colors duration-150 rounded-md hover:bg-gray-100 hover:text-gray-800 dark:hover:bg-gray-800 dark:hover:text-gray-200" href="{{ url_for('logout') }}" > <svg class="w-4 h-4 mr-3" aria-hidden="true" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" stroke="currentColor" > <path d="M11 16l-4-4m0 0l4-4m-4 4h14m-5 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h7a3 3 0 013 3v1" ></path> </svg> <span>Log out</span> </a> </li> </ul> </template> </li> </ul> </div> </header> <main class="h-full pb-16 overflow-y-auto"> <!-- Remove everything INSIDE this div to a really blank page --> {% block content %}{% endblock %} <!-- <div class="container px-6 mx-auto grid"> <h2 class="my-6 text-2xl font-semibold text-gray-700 dark:text-gray-200" > Blank </h2> </div> --> </main> </div> </div> {% block modals %}{% endblock %} {% include "extras/required_scripts.html" %} <script src="{{ url_for('static', filename='assets/js/active-page-handler.js') }}"></script> <script src="{{ url_for('static', filename='assets/js/global-search-with-filters.js') }}"></script> {% block scripts %}{% endblock %} </body> </html>
And here is my init-alpine.js file
function data() { function getThemeFromLocalStorage() { // if user already changed the theme, use it if (window.localStorage.getItem('dark')) { return JSON.parse(window.localStorage.getItem('dark')) } // else return their preferences return ( !!window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ) } function setThemeToLocalStorage(value) { window.localStorage.setItem('dark', value) } return { dark: getThemeFromLocalStorage(), toggleTheme() { this.dark = !this.dark setThemeToLocalStorage(this.dark) }, isSideMenuOpen: false, toggleSideMenu() { this.isSideMenuOpen = !this.isSideMenuOpen }, closeSideMenu() { this.isSideMenuOpen = false }, isNotificationsMenuOpen: false, toggleNotificationsMenu() { this.isNotificationsMenuOpen = !this.isNotificationsMenuOpen }, closeNotificationsMenu() { this.isNotificationsMenuOpen = false }, isProfileMenuOpen: false, toggleProfileMenu() { this.isProfileMenuOpen = !this.isProfileMenuOpen }, closeProfileMenu() { this.isProfileMenuOpen = false }, isPagesMenuOpen: false, togglePagesMenu() { this.isPagesMenuOpen = !this.isPagesMenuOpen }, // Modal isModalOpen: false, trapCleanup: null, openModal() { this.isModalOpen = true this.trapCleanup = focusTrap(document.querySelector('#modal')) }, closeModal() { this.isModalOpen = false this.trapCleanup() }, isConfirmDeleteModalOpen: false, openConfirmDeleteModal(e) { this.isConfirmDeleteModalOpen = true this.trapCleanup = focusTrap(document.querySelector('#confirm-delete-modal')) document.querySelector('#confirm-delete-button').setAttribute( 'data-event-uuid', e.target.getAttribute('data-event-uuid') ) document.querySelector('#confirm-delete-for-title').textContent = ( e.target.getAttribute('data-event-title') ) }, closeConfirmDeleteModal() { this.isConfirmDeleteModalOpen = false this.trapCleanup() document.querySelector('#confirm-delete-button').setAttribute( 'data-event-uuid', '' ) }, openChangePasswordModal() { this.isModalOpen = true this.trapCleanup = focusTrap(document.querySelector('#change-password-modal')) }, closeChangePasswordModal() { this.isModalOpen = false this.trapCleanup() }, submitEventDeletion() { fetch('/delete-event', { method: 'POST', headers: headers, body: JSON.stringify({ event_uuid: document.querySelector('#confirm-delete-button').getAttribute('data-event-uuid') }) }) .then(response => response.json()) .then((data) => { this.isConfirmDeleteModalOpen = false this.trapCleanup() document.querySelector('#confirm-delete-button').setAttribute( 'data-event-uuid', '' ) toastr.success(data.message) }) }, showSearchFilterOptions() { if (!_('search-filter')) { _('filter-options-container').classList.remove('hidden') } } } }
Everything else is working properly except dark mode.
Toggle button works but the styles are reflecting. I also checked window.localStorage.getItem('dark') and it reflects the same as the demo site on vercel.
Any help? Here is my template file
Template file
And here is my init-alpine.js file