Skip to content
This repository was archived by the owner on Jul 2, 2024. It is now read-only.

[Presentation] Database normalization (w/o styling) #223

Merged
merged 17 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions assets/icons/moon-svgrepo-com.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
101 changes: 101 additions & 0 deletions assets/icons/sun-svgrepo-com.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions src/_static/js/theme.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// theme variables
const themeAttribute = "data-theme"
const theme = {
light: "light",
dark: "dark",
}
const userTheme = localStorage.getItem(themeAttribute)
const isSystemThemeDark = window.matchMedia("(prefers-color-scheme: dark)").matches


// initial theme check
const checkTheme = () => {
if (userTheme === theme.dark || (!userTheme && isSystemThemeDark)) {
document.documentElement.setAttribute(themeAttribute, theme.dark)
} else document.documentElement.setAttribute(themeAttribute, theme.light)
}


// manual theme select
const swapTheme = () => {
const currentTheme = document.documentElement.getAttribute(themeAttribute)
const themeValue = currentTheme === theme.light ? theme.dark : theme.light
localStorage.setItem(themeAttribute, themeValue)
document.documentElement.setAttribute(themeAttribute, themeValue)
}


const swapThemeBtn = document.getElementById("swap-theme-btn");
if (swapThemeBtn) swapThemeBtn.addEventListener("click", swapTheme)

document.addEventListener("DOMContentLoaded", () => {
checkTheme()
})
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy