From dd372eb41c4f27febae19b010406a3c3e1f31572 Mon Sep 17 00:00:00 2001 From: zejzejzej3 Date: Tue, 15 Jul 2025 01:11:06 -0400 Subject: [PATCH] feat: Created Codeblock component and Copy to Clipboard Controller - Created dynamic codeblocks with theme support - Created copy to clipboard controller and attached to codeblocks - Modified lightmode index and darkmode index backgrounds --- src/components/CodeBlock.astro | 48 ++++++ .../copy_to_clipboard_controller.js | 141 ++++++++++++++++++ src/pages/index.astro | 56 ++++--- src/styles/global.css | 23 +++ 4 files changed, 249 insertions(+), 19 deletions(-) create mode 100644 src/components/CodeBlock.astro create mode 100644 src/controllers/copy_to_clipboard_controller.js diff --git a/src/components/CodeBlock.astro b/src/components/CodeBlock.astro new file mode 100644 index 0000000..bf8f19e --- /dev/null +++ b/src/components/CodeBlock.astro @@ -0,0 +1,48 @@ +--- +import { Code } from 'astro:components'; + +interface Props { + code: string; + lang: string; + wrap?: boolean; + inline?: boolean; + /** Shiki theme for light mode */ + lightTheme?: string; + /** Shiki theme for dark mode */ + darkTheme?: string; +} + +const { + code, + lang, + wrap = false, + inline = false, + lightTheme = 'min-light', + darkTheme = 'night-owl', +} = Astro.props as Props; +--- + +
+ + + + +