Skip to content

Commit

Permalink
(staging only) Add dark mode script #1867
Browse files Browse the repository at this point in the history
  • Loading branch information
sabine committed Dec 22, 2023
1 parent 941a205 commit 50b0a00
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/ocamlorg_frontend/layouts/layout.eml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ let base
?(footer_html = "")
inner =
<!DOCTYPE html>
<html lang="en">
<html lang="en" x-data="{ dark_mode: false }" :class="dark_mode ? 'dark' : 'light'">
<head id="htmx-head">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
Expand Down Expand Up @@ -56,7 +56,7 @@ inner =
<title><%s title %></title>
</head>

<body class="light">
<body>
<% if banner then ( %>
<div class="relative bg-legacy-contrast">
<div class="mx-auto py-3 px-6 sm:px-16 max-w-6xl sm:text-center">
Expand Down Expand Up @@ -84,6 +84,8 @@ inner =

<%s! footer_html %>

<button class="btn" @click="dark_mode = !dark_mode">toggle dark mode</button>

<script>
function scrollToTop() {
window.scrollTo(0, 0);
Expand Down

0 comments on commit 50b0a00

Please sign in to comment.