pagination, dark theme toggle

This commit is contained in:
yequari 2025-02-23 22:32:53 -07:00
parent f6f44d85d1
commit 27c82f6f87
9 changed files with 95 additions and 27 deletions

View File

@ -19,13 +19,32 @@ nav#social {
header .social {
width: 1.3rem;
color: var(--nav-link);
}
header .social:hover {
color: var(--nav-link-hover);
header button {
background: var(--main-bg);
color: var(--primary-link);
border: none;
padding: 0;
margin: 0;
margin-bottom: 1rem;
}
header button:hover {
color: var(--primary-link-hover);
cursor: pointer;
transition: color 0.5s;
}
header button svg {
width: 1.3rem;
}
.blurb {
font-style: italic;
}
.hidden {
display: none;
}

View File

@ -1,10 +1,7 @@
---
title: "Now"
date: 2023-04-17T15:00:46-07:00
date: 2025-02-23T15:00:46-07:00
---
# Now
Updated 2/19/25
One day this page will pull some info from APIs to create a more interesting page but for now I just manually update it as needed.

View File

@ -16,6 +16,14 @@
</div>
</div>
<div class="index-sidebar">
<div>
<h3>Site Updates</h3>
<ul>
{{ range first 3 .Site.Data.siteupdates }}
<li><strong>{{ .date }}</strong>: {{ .text }}</li>
{{ end }}
</ul>
</div>
<div>
<h3>What I'm Up To</h3>
<ul>
@ -39,14 +47,6 @@
{{ end }}
</ul>
</div>
<div>
<h3>Site Updates</h3>
<ul>
{{ range .Site.Data.siteupdates }}
<li><strong>{{ .date }}</strong>: {{ .text }}</li>
{{ end }}
</ul>
</div>
</div>
</div>
{{ end }}

View File

@ -1,7 +1,10 @@
{{ define "main" }}
<h1>{{ .Title }}</h1>
{{ .Content }}
{{ range .Pages }}
<div class="pagination">
{{ template "_internal/pagination.html" . }}
</div>
{{ range .Paginator.Pages.ByPublishDate.Reverse }}
{{ if .Params.context }}
{{ $url := urls.Parse .Params.context.url }}
<h2><a href="{{ $url.String }}">{{ .LinkTitle }}</a></h2>
@ -12,4 +15,7 @@
{{ .Summary }}
{{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }}
{{ end }}
<div class="pagination">
{{ template "_internal/pagination.html" . }}
</div>
{{ end }}

View File

@ -1,6 +1,3 @@
<p>
<button class="hidden" value="dark mode" id="theme-toggle">Button</button>
</p>
<p>
Site updated
<time datetime="{{ .Site.Lastmod.Format "2006-01-02 15:04:05 -0700" }}">{{ .Site.Lastmod.Format "January 2, 2006" }}</time>.

View File

@ -1,3 +1,18 @@
<h1><a href="/">{{ site.Title }}</a></h1>
{{ partial "menu.html" (dict "menuID" "main" "page" .) }}
{{ partial "socials.html" . }}
<button class="hidden" value="dark mode" id="theme-toggle">
<div id="icon-light-mode" class="hidden">
<svg width="100%" height="100%" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M17 12C17 14.7614 14.7614 17 12 17C9.23858 17 7 14.7614 7 12C7 9.23858 9.23858 7 12 7C14.7614 7 17 9.23858 17 12Z" fill="currentColor"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M12 1.25C12.4142 1.25 12.75 1.58579 12.75 2V4C12.75 4.41421 12.4142 4.75 12 4.75C11.5858 4.75 11.25 4.41421 11.25 4V2C11.25 1.58579 11.5858 1.25 12 1.25ZM3.66865 3.71609C3.94815 3.41039 4.42255 3.38915 4.72825 3.66865L6.95026 5.70024C7.25596 5.97974 7.2772 6.45413 6.9977 6.75983C6.7182 7.06553 6.2438 7.08677 5.9381 6.80727L3.71609 4.77569C3.41039 4.49619 3.38915 4.02179 3.66865 3.71609ZM20.3314 3.71609C20.6109 4.02179 20.5896 4.49619 20.2839 4.77569L18.0619 6.80727C17.7562 7.08677 17.2818 7.06553 17.0023 6.75983C16.7228 6.45413 16.744 5.97974 17.0497 5.70024L19.2718 3.66865C19.5775 3.38915 20.0518 3.41039 20.3314 3.71609ZM1.25 12C1.25 11.5858 1.58579 11.25 2 11.25H4C4.41421 11.25 4.75 11.5858 4.75 12C4.75 12.4142 4.41421 12.75 4 12.75H2C1.58579 12.75 1.25 12.4142 1.25 12ZM19.25 12C19.25 11.5858 19.5858 11.25 20 11.25H22C22.4142 11.25 22.75 11.5858 22.75 12C22.75 12.4142 22.4142 12.75 22 12.75H20C19.5858 12.75 19.25 12.4142 19.25 12ZM17.0255 17.0252C17.3184 16.7323 17.7933 16.7323 18.0862 17.0252L20.3082 19.2475C20.6011 19.5404 20.601 20.0153 20.3081 20.3082C20.0152 20.6011 19.5403 20.601 19.2475 20.3081L17.0255 18.0858C16.7326 17.7929 16.7326 17.3181 17.0255 17.0252ZM6.97467 17.0253C7.26756 17.3182 7.26756 17.7931 6.97467 18.086L4.75244 20.3082C4.45955 20.6011 3.98468 20.6011 3.69178 20.3082C3.39889 20.0153 3.39889 19.5404 3.69178 19.2476L5.91401 17.0253C6.2069 16.7324 6.68177 16.7324 6.97467 17.0253ZM12 19.25C12.4142 19.25 12.75 19.5858 12.75 20V22C12.75 22.4142 12.4142 22.75 12 22.75C11.5858 22.75 11.25 22.4142 11.25 22V20C11.25 19.5858 11.5858 19.25 12 19.25Z" fill="currentColor"/>
</svg>
</div>
<div id="icon-dark-mode" class="hidden">
<svg width="100%" height="100%" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M19.9001 2.30719C19.7392 1.8976 19.1616 1.8976 19.0007 2.30719L18.5703 3.40247C18.5212 3.52752 18.4226 3.62651 18.298 3.67583L17.2067 4.1078C16.7986 4.26934 16.7986 4.849 17.2067 5.01054L18.298 5.44252C18.4226 5.49184 18.5212 5.59082 18.5703 5.71587L19.0007 6.81115C19.1616 7.22074 19.7392 7.22074 19.9001 6.81116L20.3305 5.71587C20.3796 5.59082 20.4782 5.49184 20.6028 5.44252L21.6941 5.01054C22.1022 4.849 22.1022 4.26934 21.6941 4.1078L20.6028 3.67583C20.4782 3.62651 20.3796 3.52752 20.3305 3.40247L19.9001 2.30719Z" fill="currentColor"/>
<path d="M16.0328 8.12967C15.8718 7.72009 15.2943 7.72009 15.1333 8.12967L14.9764 8.52902C14.9273 8.65407 14.8287 8.75305 14.7041 8.80237L14.3062 8.95987C13.8981 9.12141 13.8981 9.70107 14.3062 9.86261L14.7041 10.0201C14.8287 10.0694 14.9273 10.1684 14.9764 10.2935L15.1333 10.6928C15.2943 11.1024 15.8718 11.1024 16.0328 10.6928L16.1897 10.2935C16.2388 10.1684 16.3374 10.0694 16.462 10.0201L16.8599 9.86261C17.268 9.70107 17.268 9.12141 16.8599 8.95987L16.462 8.80237C16.3374 8.75305 16.2388 8.65407 16.1897 8.52902L16.0328 8.12967Z" fill="currentColor"/>
<path d="M12 22C17.5228 22 22 17.5228 22 12C22 11.5373 21.3065 11.4608 21.0672 11.8568C19.9289 13.7406 17.8615 15 15.5 15C11.9101 15 9 12.0899 9 8.5C9 6.13845 10.2594 4.07105 12.1432 2.93276C12.5392 2.69347 12.4627 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z" fill="currentColor"/>
</svg>
</div>
</button>

View File

@ -1,4 +1,4 @@
@import url(https://fonts.bunny.net/css?family=share-tech-mono:400);
@import url(https://fonts.bunny.net/css?family=yaldevi:400,600|share-tech-mono:400|tilt-neon:400|unica-one:400);
@media (prefers-color-scheme: dark) {
:root {
@ -33,6 +33,7 @@ body {
margin: 1rem auto;
max-width: 900px;
background: var(--content-bg);
font-family: 'Yaldevi', sans-serif;
font-size: 1.2rem;
}
@ -45,11 +46,15 @@ header {
flex-flow: row wrap;
justify-content: space-between;
align-items: baseline;
font-family: 'Share Tech Mono', 'Courier New', Courier, monospace;
font-family: 'Unica One', display;
text-transform: lowercase;
font-size: 1.3rem;
}
h1 {
/* font-family: 'Unica One', display; */
}
header h1 {
display: inline;
margin: 0;
@ -83,6 +88,7 @@ footer {
border-top: 1px solid var(--accent);
margin-top: 1rem;
text-align: center;
font-family: 'Unica One', display;
}
a {
@ -102,6 +108,23 @@ figure {
max-width: 100%;
}
pre {
overflow-x: scroll;
}
code {
font-family: 'Share Tech Mono', monospace;
}
.pagination {
text-align: center;
}
.pagination li {
display: inline-block;
padding: 0 0.3rem;
}
@media only screen and (max-width: 450px) {
header h1 {
display: block;

View File

@ -18,6 +18,10 @@ const lightMode = {
const root = document.querySelector(':root');
const themeToggle = document.getElementById('theme-toggle');
const lightModeIcon = document.getElementById('icon-light-mode');
const darkModeIcon = document.getElementById('icon-dark-mode');
console.log(lightModeIcon)
const applyTheme = (theme) => {
root.style.setProperty("--main-bg", theme.mainBg);
@ -30,21 +34,22 @@ const applyTheme = (theme) => {
const enableDarkMode = () => {
applyTheme(darkMode);
lightModeIcon.className = '';
darkModeIcon.className = 'hidden';
localStorage.setItem('theme', 'dark');
themeToggle.innerText = '☀️ Light Theme';
themeToggle.value = 'Light Mode';
console.log(lightModeIcon)
}
const disableDarkMode = () => {
applyTheme(lightMode);
lightModeIcon.className = 'hidden';
darkModeIcon.className = '';
localStorage.setItem('theme', 'light');
themeToggle.innerText = '🌙 Dark Theme';
themeToggle.value = 'Dark Mode';
console.log(lightModeIcon)
}
const detectTheme = () => {
let theme = 'light';
let themeObj = lightMode;
if (localStorage.getItem('theme')) {
theme = localStorage.getItem('theme');

View File

@ -1,8 +1,14 @@
{{ define "main" }}
<h1>{{ .Title }}</h1>
{{ .Content }}
{{ range .Pages }}
<div class="pagination">
{{ template "_internal/pagination.html" . }}
</div>
{{ range .Paginator.Pages.ByPublishDate.Reverse }}
<h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>
{{ .Summary }}
{{ end }}
<div class="pagination">
{{ template "_internal/pagination.html" . }}
</div>
{{ end }}