diff --git a/README.md b/README.md index 65609e8..1c98702 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # coredump +[![pnpm](https://img.shields.io/badge/maintained%20with-pnpm-cc00ff.svg?style=for-the-badge&logo=pnpm)](https://pnpm.io/) + My personal website and its associated blog. Written in [SvelteKit](https://kit.svelte.dev) using [TailwindCSS](https://tailwindcss.com/) and components from [shadcn-svelte](https://www.shadcn-svelte.com/). ## Running locally diff --git a/src/lib/components/Blog/Article.svelte b/src/lib/components/Blog/Article.svelte index debe5cb..dbc9593 100644 --- a/src/lib/components/Blog/Article.svelte +++ b/src/lib/components/Blog/Article.svelte @@ -12,7 +12,7 @@
{doc.title}
-
+

{doc.title}

@@ -28,10 +28,10 @@ length={doc.content.length} reverseDateAndRest /> -
+ +
{@html doc.content} -
diff --git a/src/lib/components/Blog/PostMetadata.svelte b/src/lib/components/Blog/PostMetadata.svelte index fb3420d..d8ee9d0 100644 --- a/src/lib/components/Blog/PostMetadata.svelte +++ b/src/lib/components/Blog/PostMetadata.svelte @@ -10,7 +10,11 @@ - `time` - A unix epoch integer representing the time the post was published. - `length` - An integer representing amount of words in the post. - `reverseDateAndRest` - A boolean that determines whether the date should be displayed at the bottom of the metadata. - --> + + @slots + + - toc - Place a table of contents here +--> @@ -24,6 +24,7 @@ @@ -32,3 +33,9 @@ {/if} + + diff --git a/src/lib/components/ui/accordion/accordion-content.svelte b/src/lib/components/ui/accordion/accordion-content.svelte new file mode 100644 index 0000000..da7265d --- /dev/null +++ b/src/lib/components/ui/accordion/accordion-content.svelte @@ -0,0 +1,26 @@ + + + +
+ +
+
diff --git a/src/lib/components/ui/accordion/accordion-item.svelte b/src/lib/components/ui/accordion/accordion-item.svelte new file mode 100644 index 0000000..e66baca --- /dev/null +++ b/src/lib/components/ui/accordion/accordion-item.svelte @@ -0,0 +1,14 @@ + + + + + diff --git a/src/lib/components/ui/accordion/accordion-trigger.svelte b/src/lib/components/ui/accordion/accordion-trigger.svelte new file mode 100644 index 0000000..fe85094 --- /dev/null +++ b/src/lib/components/ui/accordion/accordion-trigger.svelte @@ -0,0 +1,28 @@ + + + + svg]:rotate-180", + className + )} + {...$$restProps} + on:click + > + + + + diff --git a/src/lib/components/ui/accordion/index.ts b/src/lib/components/ui/accordion/index.ts new file mode 100644 index 0000000..3fc36e7 --- /dev/null +++ b/src/lib/components/ui/accordion/index.ts @@ -0,0 +1,17 @@ +import { Accordion as AccordionPrimitive } from "bits-ui"; +import Content from "./accordion-content.svelte"; +import Item from "./accordion-item.svelte"; +import Trigger from "./accordion-trigger.svelte"; + +const Root = AccordionPrimitive.Root; +export { + Root, + Content, + Item, + Trigger, + // + Root as Accordion, + Content as AccordionContent, + Item as AccordionItem, + Trigger as AccordionTrigger, +}; diff --git a/src/lib/components/ui/drawer/drawer-content.svelte b/src/lib/components/ui/drawer/drawer-content.svelte new file mode 100644 index 0000000..54a4079 --- /dev/null +++ b/src/lib/components/ui/drawer/drawer-content.svelte @@ -0,0 +1,24 @@ + + + + + +
+ + + diff --git a/src/lib/components/ui/drawer/drawer-description.svelte b/src/lib/components/ui/drawer/drawer-description.svelte new file mode 100644 index 0000000..b901385 --- /dev/null +++ b/src/lib/components/ui/drawer/drawer-description.svelte @@ -0,0 +1,18 @@ + + + + + diff --git a/src/lib/components/ui/drawer/drawer-footer.svelte b/src/lib/components/ui/drawer/drawer-footer.svelte new file mode 100644 index 0000000..c6c07ad --- /dev/null +++ b/src/lib/components/ui/drawer/drawer-footer.svelte @@ -0,0 +1,16 @@ + + +
+ +
diff --git a/src/lib/components/ui/drawer/drawer-header.svelte b/src/lib/components/ui/drawer/drawer-header.svelte new file mode 100644 index 0000000..f857176 --- /dev/null +++ b/src/lib/components/ui/drawer/drawer-header.svelte @@ -0,0 +1,19 @@ + + +
+ +
diff --git a/src/lib/components/ui/drawer/drawer-nested.svelte b/src/lib/components/ui/drawer/drawer-nested.svelte new file mode 100644 index 0000000..79b68e3 --- /dev/null +++ b/src/lib/components/ui/drawer/drawer-nested.svelte @@ -0,0 +1,12 @@ + + + + + diff --git a/src/lib/components/ui/drawer/drawer-overlay.svelte b/src/lib/components/ui/drawer/drawer-overlay.svelte new file mode 100644 index 0000000..ccc7322 --- /dev/null +++ b/src/lib/components/ui/drawer/drawer-overlay.svelte @@ -0,0 +1,18 @@ + + + + + diff --git a/src/lib/components/ui/drawer/drawer-title.svelte b/src/lib/components/ui/drawer/drawer-title.svelte new file mode 100644 index 0000000..cfbe596 --- /dev/null +++ b/src/lib/components/ui/drawer/drawer-title.svelte @@ -0,0 +1,18 @@ + + + + + diff --git a/src/lib/components/ui/drawer/drawer.svelte b/src/lib/components/ui/drawer/drawer.svelte new file mode 100644 index 0000000..40eae5e --- /dev/null +++ b/src/lib/components/ui/drawer/drawer.svelte @@ -0,0 +1,12 @@ + + + + + diff --git a/src/lib/components/ui/drawer/index.ts b/src/lib/components/ui/drawer/index.ts new file mode 100644 index 0000000..df14a98 --- /dev/null +++ b/src/lib/components/ui/drawer/index.ts @@ -0,0 +1,40 @@ +import { Drawer as DrawerPrimitive } from "vaul-svelte"; + +import Root from "./drawer.svelte"; +import Content from "./drawer-content.svelte"; +import Description from "./drawer-description.svelte"; +import Overlay from "./drawer-overlay.svelte"; +import Footer from "./drawer-footer.svelte"; +import Header from "./drawer-header.svelte"; +import Title from "./drawer-title.svelte"; +import NestedRoot from "./drawer-nested.svelte"; + +const Trigger = DrawerPrimitive.Trigger; +const Portal = DrawerPrimitive.Portal; +const Close = DrawerPrimitive.Close; + +export { + Root, + NestedRoot, + Content, + Description, + Overlay, + Footer, + Header, + Title, + Trigger, + Portal, + Close, + // + Root as Drawer, + NestedRoot as DrawerNestedRoot, + Content as DrawerContent, + Description as DrawerDescription, + Overlay as DrawerOverlay, + Footer as DrawerFooter, + Header as DrawerHeader, + Title as DrawerTitle, + Trigger as DrawerTrigger, + Portal as DrawerPortal, + Close as DrawerClose, +}; diff --git a/src/routes/blog/+page.svelte b/src/routes/blog/+page.svelte index a97913c..6c5e0d5 100644 --- a/src/routes/blog/+page.svelte +++ b/src/routes/blog/+page.svelte @@ -48,7 +48,10 @@ > my blog on computer science, math, games, art, and more.

- +
Archived Posts diff --git a/src/routes/blog/[year]/[slug]/+page.svelte b/src/routes/blog/[year]/[slug]/+page.svelte index ab5688b..e361590 100644 --- a/src/routes/blog/[year]/[slug]/+page.svelte +++ b/src/routes/blog/[year]/[slug]/+page.svelte @@ -3,12 +3,12 @@ import Code from 'svelte-radix/Code.svelte'; import type { PageData } from './$types'; // import { config } from '$lib/stores/index.js'; - import { cn } from '$lib/utils.js'; import Article from '$lib/components/Blog/Article.svelte'; - import { toc, createTocStore } from '@svelte-put/toc'; + import { toc, createTocStore, toclink } from '@svelte-put/toc'; import StickyToc from '$lib/components/Toc/StickyToc.svelte'; import { onMount } from 'svelte'; - import MobileTocFooter from '$lib/components/MobileTocFooter.svelte'; + import * as Accordion from '$lib/components/ui/accordion'; + import * as Card from '$lib/components/ui/card'; const tocStore = createTocStore(); @@ -24,6 +24,13 @@ description: 'An insightful and longer description of the post. This should be a bit more detailed than the blurb. It should give the reader a good idea of what the post is about.' }; + + const calcTextClasses = (el: HTMLElement) => { + if (el.tagName === 'H1') return 'text-xl font-medium'; + if (el.tagName === 'H2') return 'text-lg'; + return 'text-sm text-muted-foreground'; + }; + // $: doc = data.metadata; // $: componentSource = data.metadata.source?.replace('default', $config.style ?? 'default'); @@ -47,7 +54,34 @@ scrollMarginTop: 120 }} > -
- - diff --git a/src/routes/blog/[year]/[slug]/+page.ts b/src/routes/blog/[year]/[slug]/+page.ts index d159661..b1329b1 100644 --- a/src/routes/blog/[year]/[slug]/+page.ts +++ b/src/routes/blog/[year]/[slug]/+page.ts @@ -8,6 +8,7 @@ export const prerender = true; const options = { throwOnError: false }; + marked.use(markedKatex(options)); marked.use(markedAlert());