[skip prod] Sidebar tweaks

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
Harsh Shandilya 2020-02-18 03:03:01 +05:30
parent 439e236d0e
commit 8bc7da737a
2 changed files with 11 additions and 16 deletions

View File

@ -1,17 +1,6 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"{{with .Site.LanguageCode}} xml:lang="{{.}}" lang="{{.}}"{{end}}>
<head>
<script>
const STORAGE_KEY = 'user-color-scheme';
const applySetting = passedSetting => {
let currentSetting = passedSetting || localStorage.getItem(STORAGE_KEY);
if (currentSetting) {
document.documentElement.setAttribute('data-user-color-scheme', currentSetting);
}
};
applySetting();
</script>
<link href="https://gmpg.org/xfn/11" rel="profile">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
{{ hugo.Generator }}

View File

@ -16,16 +16,22 @@
</ul>
</nav>
<div class="user-toggle">
<button class="toggle-button js-mode-toggle" aria-label="Dark theme switch">
<span class="toggle-button__icon" aria-hidden="true"></span>
</button>
</div>
<p>{{ with .Site.Params.copyright }}{{.}}{{ else }}&copy; {{ now.Format "2006"}}. All rights reserved. {{end}}</p>
<button class="toggle-button js-mode-toggle" aria-label="Dark theme switch">
<span class="toggle-button__icon" aria-hidden="true"></span>
</button>
</div>
</div>
<script>
const COLOR_MODE_KEY = '--color-mode';
const modeToggleButton = document.querySelector('.js-mode-toggle');
const STORAGE_KEY = 'user-color-scheme';
const applySetting = passedSetting => {
let currentSetting = passedSetting || localStorage.getItem(STORAGE_KEY);
if (currentSetting) {
document.documentElement.setAttribute('data-user-color-scheme', currentSetting);
}
};
const getCSSCustomProp = propKey => {
let response = getComputedStyle(document.documentElement).getPropertyValue(propKey);
if (response.length) {