|
21 | 21 | <%= stylesheet_link_tag :app %> |
22 | 22 | </head> |
23 | 23 |
|
24 | | - <body> |
| 24 | + <body class="bg-white text-gray-800 dark:bg-gray-900 dark:text-gray-400"> |
25 | 25 | <header> |
26 | 26 | <nav class="bg-white border-gray-200 dark:bg-gray-900"> |
27 | 27 | <div class="max-w-screen-xl flex flex-wrap items-center justify-between mx-auto p-4"> |
|
44 | 44 | <li> |
45 | 45 | <%= link_to("GitHub", "https://github.com/substancelab/flowbite-components", class: "block py-2 px-3 text-gray-900 rounded-sm hover:bg-gray-100 md:hover:bg-transparent md:border-0 md:hover:text-blue-700 md:p-0 dark:text-white md:dark:hover:text-blue-500 dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent") %> |
46 | 46 | </li> |
| 47 | + <li> |
| 48 | + <button data-theme-toggle="dark" class="dark:hidden"> |
| 49 | + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="size-6"> |
| 50 | + <path fill-rule="evenodd" d="M9.528 1.718a.75.75 0 0 1 .162.819A8.97 8.97 0 0 0 9 6a9 9 0 0 0 9 9 8.97 8.97 0 0 0 3.463-.69.75.75 0 0 1 .981.98 10.503 10.503 0 0 1-9.694 6.46c-5.799 0-10.5-4.7-10.5-10.5 0-4.368 2.667-8.112 6.46-9.694a.75.75 0 0 1 .818.162Z" clip-rule="evenodd" /> |
| 51 | + </svg> |
| 52 | + </button> |
| 53 | + <button data-theme-toggle="light" class="hidden dark:block"> |
| 54 | + <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6"> |
| 55 | + <path stroke-linecap="round" stroke-linejoin="round" d="M12 18v-5.25m0 0a6.01 6.01 0 0 0 1.5-.189m-1.5.189a6.01 6.01 0 0 1-1.5-.189m3.75 7.478a12.06 12.06 0 0 1-4.5 0m3.75 2.383a14.406 14.406 0 0 1-3 0M14.25 18v-.192c0-.983.658-1.823 1.508-2.316a7.5 7.5 0 1 0-7.517 0c.85.493 1.509 1.333 1.509 2.316V18" /> |
| 56 | + </svg> |
| 57 | + </button> |
| 58 | + </li> |
47 | 59 | </ul> |
48 | 60 | </div> |
49 | 61 | </div> |
|
56 | 68 | </article> |
57 | 69 | </main> |
58 | 70 |
|
59 | | - <footer class="mt-28 px-5 py-5 flex border-t-2 border-gray-200 dark:border-gray-70"> |
| 71 | + <footer class="mt-28 px-5 py-5 flex border-t-2 border-gray-200 dark:border-gray-700"> |
60 | 72 | <div class="space-y-5"> |
61 | 73 | <div class="flex space-x-5"> |
62 | 74 | <%= link_to("GitHub", "https://github.com/substancelab/flowbite-components") %> |
|
74 | 86 | </div> |
75 | 87 | </div> |
76 | 88 | </footer> |
| 89 | + |
| 90 | + <script> |
| 91 | + function setTheme(theme) { |
| 92 | + document.documentElement.setAttribute('data-theme', theme); |
| 93 | + localStorage.setItem("theme", theme); |
| 94 | + } |
| 95 | + setTheme(localStorage.getItem('theme') || 'light'); |
| 96 | + |
| 97 | + document.querySelectorAll("[data-theme-toggle]").forEach((element) => { |
| 98 | + element.addEventListener("click", () => { |
| 99 | + const theme = element.getAttribute("data-theme-toggle"); |
| 100 | + if (theme) { |
| 101 | + setTheme(theme); |
| 102 | + } |
| 103 | + }); |
| 104 | + }); |
| 105 | + </script> |
77 | 106 | </body> |
78 | 107 | </html> |
0 commit comments