Merge pull request #43 from barrettruth/feat/refactor
remove theme and public gist visibility
This commit is contained in:
commit
fb8e7079a1
8 changed files with 2 additions and 133 deletions
|
|
@ -5,37 +5,6 @@ import rehypeKatex from "rehype-katex";
|
||||||
import remarkMath from "remark-math";
|
import remarkMath from "remark-math";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
|
|
||||||
const midnight = {
|
|
||||||
name: "midnight",
|
|
||||||
type: "dark",
|
|
||||||
colors: {
|
|
||||||
"editor.background": "#121212",
|
|
||||||
"editor.foreground": "#e0e0e0",
|
|
||||||
},
|
|
||||||
tokenColors: [
|
|
||||||
{
|
|
||||||
scope: [
|
|
||||||
"storage.type",
|
|
||||||
"storage.modifier",
|
|
||||||
"keyword.control",
|
|
||||||
"keyword.operator.new",
|
|
||||||
],
|
|
||||||
settings: { foreground: "#7aa2f7" },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
scope: [
|
|
||||||
"string",
|
|
||||||
"constant",
|
|
||||||
"constant.numeric",
|
|
||||||
"constant.language",
|
|
||||||
"constant.character",
|
|
||||||
"number",
|
|
||||||
],
|
|
||||||
settings: { foreground: "#98c379" },
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
||||||
const daylight = {
|
const daylight = {
|
||||||
name: "daylight",
|
name: "daylight",
|
||||||
type: "light",
|
type: "light",
|
||||||
|
|
@ -97,7 +66,6 @@ export default defineConfig({
|
||||||
shikiConfig: {
|
shikiConfig: {
|
||||||
themes: {
|
themes: {
|
||||||
light: daylight,
|
light: daylight,
|
||||||
dark: midnight,
|
|
||||||
},
|
},
|
||||||
langs: [],
|
langs: [],
|
||||||
wrap: true,
|
wrap: true,
|
||||||
|
|
|
||||||
|
|
@ -251,30 +251,6 @@
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
|
|
||||||
const themeToggle = document.getElementById("theme-toggle");
|
|
||||||
if (themeToggle) {
|
|
||||||
function updateBearVisual() {
|
|
||||||
const currentTheme =
|
|
||||||
document.documentElement.getAttribute("data-theme");
|
|
||||||
if (currentTheme === "dark") {
|
|
||||||
themeToggle.textContent = "☾⊂ʕ•ᴥ•ʔ";
|
|
||||||
} else {
|
|
||||||
themeToggle.textContent = "☼⊂ʕ•ᴥ•ʔ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
updateBearVisual();
|
|
||||||
|
|
||||||
themeToggle.addEventListener("click", () => {
|
|
||||||
const currentTheme =
|
|
||||||
document.documentElement.getAttribute("data-theme");
|
|
||||||
const newTheme = currentTheme === "dark" ? "light" : "dark";
|
|
||||||
document.documentElement.setAttribute("data-theme", newTheme);
|
|
||||||
localStorage.setItem("theme", newTheme);
|
|
||||||
updateBearVisual();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
window.addEventListener("beforeunload", () => {
|
window.addEventListener("beforeunload", () => {
|
||||||
const el = promptEl();
|
const el = promptEl();
|
||||||
if (el) el.textContent = TERMINAL_PROMPT;
|
if (el) el.textContent = TERMINAL_PROMPT;
|
||||||
|
|
|
||||||
|
|
@ -150,16 +150,6 @@
|
||||||
--grid-color: rgba(200, 200, 200, 0.4);
|
--grid-color: rgba(200, 200, 200, 0.4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (prefers-color-scheme: dark) {
|
|
||||||
:root {
|
|
||||||
--bg: #000;
|
|
||||||
--text: #fff;
|
|
||||||
--code-bg: #121212;
|
|
||||||
--border: #2d2d2d;
|
|
||||||
--grid-color: rgba(55, 55, 55, 0.4);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[data-theme="light"] {
|
[data-theme="light"] {
|
||||||
--bg: #fff;
|
--bg: #fff;
|
||||||
--text: #000;
|
--text: #000;
|
||||||
|
|
@ -168,14 +158,6 @@
|
||||||
--grid-color: rgba(200, 200, 200, 0.4);
|
--grid-color: rgba(200, 200, 200, 0.4);
|
||||||
}
|
}
|
||||||
|
|
||||||
[data-theme="dark"] {
|
|
||||||
--bg: #000;
|
|
||||||
--text: #fff;
|
|
||||||
--code-bg: #121212;
|
|
||||||
--border: #2d2d2d;
|
|
||||||
--grid-color: rgba(55, 55, 55, 0.4);
|
|
||||||
}
|
|
||||||
|
|
||||||
pre,
|
pre,
|
||||||
code,
|
code,
|
||||||
pre code,
|
pre code,
|
||||||
|
|
@ -208,11 +190,6 @@ footer {
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
}
|
}
|
||||||
|
|
||||||
#theme-toggle {
|
|
||||||
cursor: pointer;
|
|
||||||
user-select: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.main {
|
.main {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@
|
||||||
<a href="/about.html" data-topic="about">about</a>
|
<a href="/about.html" data-topic="about">about</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="footer-links-right">
|
<div class="footer-links-right">
|
||||||
<a href="/gist.html" data-topic="gist">gist</a>
|
|
||||||
<a href="/git.html" data-topic="git">git</a>
|
<a href="/git.html" data-topic="git">git</a>
|
||||||
<a
|
<a
|
||||||
href="https://www.linkedin.com/in/barrett-ruth/"
|
href="https://www.linkedin.com/in/barrett-ruth/"
|
||||||
|
|
|
||||||
|
|
@ -26,14 +26,9 @@ const promptText = topic ? `barrett@ruth:~$ ${topic}` : "barrett@ruth:~$";
|
||||||
<span class="terminal-cursor"></span>
|
<span class="terminal-cursor"></span>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<span id="theme-toggle">☼⊂ʕ•ᴥ•ʔ</span>
|
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
#theme-toggle {
|
|
||||||
cursor: pointer;
|
|
||||||
user-select: none;
|
|
||||||
}
|
|
||||||
@media (max-width: 640px) {
|
@media (max-width: 640px) {
|
||||||
header {
|
header {
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
|
|
||||||
|
|
@ -13,17 +13,6 @@ const {
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<script is:inline>
|
|
||||||
(function () {
|
|
||||||
const stored = localStorage.getItem("theme");
|
|
||||||
const theme =
|
|
||||||
stored ||
|
|
||||||
(matchMedia("(prefers-color-scheme: dark)").matches
|
|
||||||
? "dark"
|
|
||||||
: "light");
|
|
||||||
document.documentElement.setAttribute("data-theme", theme);
|
|
||||||
})();
|
|
||||||
</script>
|
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
---
|
|
||||||
import BaseLayout from "../layouts/BaseLayout.astro";
|
|
||||||
import { getCollection } from "astro:content";
|
|
||||||
import { sortItem } from "../utils/sort.js";
|
|
||||||
|
|
||||||
const title = "gists";
|
|
||||||
const gists = await getCollection("gists");
|
|
||||||
gists.sort(sortItem);
|
|
||||||
---
|
|
||||||
|
|
||||||
<BaseLayout title={title}>
|
|
||||||
<slot name="head" slot="head">
|
|
||||||
<link rel="stylesheet" href="/styles/index.css" />
|
|
||||||
<script src="/scripts/index.js" is:inline></script>
|
|
||||||
</slot>
|
|
||||||
|
|
||||||
<div class="content">
|
|
||||||
<ul class="topics">
|
|
||||||
{
|
|
||||||
gists.map((gist) => (
|
|
||||||
<li class="topic">
|
|
||||||
<a
|
|
||||||
href={`/gist/${gist.slug}.html`}
|
|
||||||
data-topic={`gist/${gist.slug}`}
|
|
||||||
>
|
|
||||||
{gist.data.title || gist.slug}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
))
|
|
||||||
}
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</BaseLayout>
|
|
||||||
|
|
@ -6,9 +6,8 @@ export type CollectionKey =
|
||||||
| "meditations"
|
| "meditations"
|
||||||
| "autonomous-racing"
|
| "autonomous-racing"
|
||||||
| "git"
|
| "git"
|
||||||
| "gists"
|
|
||||||
| "death";
|
| "death";
|
||||||
export type PostCollection = Exclude<CollectionKey, "git" | "gists">;
|
export type PostCollection = Exclude<CollectionKey, "git">;
|
||||||
|
|
||||||
export type AnyCollectionEntry =
|
export type AnyCollectionEntry =
|
||||||
| CollectionEntry<"algorithms">
|
| CollectionEntry<"algorithms">
|
||||||
|
|
@ -16,5 +15,4 @@ export type AnyCollectionEntry =
|
||||||
| CollectionEntry<"meditations">
|
| CollectionEntry<"meditations">
|
||||||
| CollectionEntry<"autonomous-racing">
|
| CollectionEntry<"autonomous-racing">
|
||||||
| CollectionEntry<"death">
|
| CollectionEntry<"death">
|
||||||
| CollectionEntry<"git">
|
| CollectionEntry<"git">;
|
||||||
| CollectionEntry<"gists">;
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue