From 675849b8842eb1f4695eb3b2aa22ab0f4f239997 Mon Sep 17 00:00:00 2001 From: ryan Date: Thu, 2 Oct 2025 15:14:17 -0700 Subject: [PATCH] Dynamic sidebar --- hindki/astro.config.mjs | 1 + hindki/src/components/AddVocabForm.tsx | 62 ++++++++++++++------- hindki/src/components/FlashCard.tsx | 1 - hindki/src/components/PageSidebar.astro | 2 +- hindki/src/components/Sidebar.astro | 41 ++++++++++++++ hindki/src/lib/storage.ts | 13 ++++- hindki/src/lib/utils.ts | 7 +++ hindki/src/pages/api/types.json.ts | 25 +++++++++ hindki/src/pages/edit/add-vocab.astro | 1 + hindki/src/pages/vocabulary/[tag].astro | 72 +++++++++++++------------ hindki/src/styles/custom.css | 29 ++++------ 11 files changed, 178 insertions(+), 76 deletions(-) create mode 100644 hindki/src/components/Sidebar.astro create mode 100644 hindki/src/lib/utils.ts create mode 100644 hindki/src/pages/api/types.json.ts diff --git a/hindki/astro.config.mjs b/hindki/astro.config.mjs index b89c48d..03b08db 100644 --- a/hindki/astro.config.mjs +++ b/hindki/astro.config.mjs @@ -97,6 +97,7 @@ export default defineConfig({ }, ], components: { + Sidebar: "@/components/Sidebar.astro", PageSidebar: "@/components/PageSidebar.astro", }, }), diff --git a/hindki/src/components/AddVocabForm.tsx b/hindki/src/components/AddVocabForm.tsx index 4db8d41..5d783ba 100644 --- a/hindki/src/components/AddVocabForm.tsx +++ b/hindki/src/components/AddVocabForm.tsx @@ -1,5 +1,6 @@ import React, { useState, useEffect } from 'react'; import type { Tag } from '@/types/types'; +import { titlecase } from '@/lib/utils'; interface WordFormData { english: string; @@ -242,7 +243,7 @@ export default function AddVocabForm() {
- +

Categories

{tags.map((tag) => ( ))}
@@ -286,8 +286,8 @@ export default function AddVocabForm() {
)} - -
+

New Word

+
-
+
-
+
-
+