From 108f8129145f096604de817e30444682192380ff Mon Sep 17 00:00:00 2001 From: Joseph Montanaro Date: Tue, 7 Apr 2026 06:22:43 -0400 Subject: [PATCH] add supporting components for sidenotes post --- posts/sidenotes.mdx | 3 +- src/projects/sidenotes/UnstyledSidenote.astro | 51 +++++++++++++++++++ src/projects/sidenotes/sidenote.css | 51 +++++++++++++++++++ tsconfig.json | 1 + 4 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 src/projects/sidenotes/UnstyledSidenote.astro create mode 100644 src/projects/sidenotes/sidenote.css diff --git a/posts/sidenotes.mdx b/posts/sidenotes.mdx index 9acaf56..8bdde52 100644 --- a/posts/sidenotes.mdx +++ b/posts/sidenotes.mdx @@ -6,7 +6,8 @@ draft: true --- import Sidenote from '@components/Sidenote.astro'; -import UnstyledSidenote from '@components/UnstyledSidenote.astro'; +import UnstyledSidenote from '@projects/sidenotes/UnstyledSidenote.astro'; +import '@projects/sidenotes/sidenote.css'; One of my major goals when building this blog was to have sidenotes. I've always been a fan of sidenotes on the web, because the most comfortable reading width for a column of text is far less than the absurd amounts of screen width we tend to have available, and what else are we going to use it for?Some sites use it for ads, of course, which is yet another example of how advertising ruins everything. diff --git a/src/projects/sidenotes/UnstyledSidenote.astro b/src/projects/sidenotes/UnstyledSidenote.astro new file mode 100644 index 0000000..e226bab --- /dev/null +++ b/src/projects/sidenotes/UnstyledSidenote.astro @@ -0,0 +1,51 @@ +--- +export interface Props { + floatingCounter: boolean, + class: string, +}; + +const { class: classList, floatingCounter} = Astro.props; +--- + + + + + + + diff --git a/src/projects/sidenotes/sidenote.css b/src/projects/sidenotes/sidenote.css new file mode 100644 index 0000000..84fbcbd --- /dev/null +++ b/src/projects/sidenotes/sidenote.css @@ -0,0 +1,51 @@ + .counter { + counter-increment: sidenote; + } + + .counter::before { + content: counter(sidenote); + color: var(--accent-color); + font-size: 0.75rem; + position: relative; + bottom: 0.2rem; + margin-left: 0.1rem; + } + + .sidenote-absolute { + position: absolute; + left: calc(50% + min(100%, var(--content-width)) / 2 + 1rem); + max-width: 12rem; + font-size: 0.75rem; + } + .sidenote-absolute::before { + content: counter(sidenote); + color: var(--accent-color); + font-size: 0.75rem; + position: relative; + bottom: 0.2rem; + margin-right: 0.1rem; + } + + .sn-float { + float: right; + } + .sn-clear { + float: right; + clear: right; + } + .sn-gutter { + float: right; + width: 14rem; + margin-right: -14rem; + } + .sn-gap { + float: right; + width: 14rem; + margin-right: -16rem; + } + .sn-var-width { + float: right; + --width: min(14rem, calc(50vw - var(--content-width) / 2) - 2rem); + width: var(--width); + margin-right: calc(0rem - var(--width) - 2rem); + } diff --git a/tsconfig.json b/tsconfig.json index 1510dca..289a7d8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,6 +7,7 @@ "@components/*": ["./src/components/*"], "@layouts/*": ["./src/layouts/*"], "@lib/*": ["./src/lib/*"], + "@projects/*": ["./src/projects/*"], "@styles/*": ["./src/styles/*"] } }