From ff0a4280e2a13b7b08974da7b7864f5aeba17620 Mon Sep 17 00:00:00 2001 From: Emma Date: Wed, 28 Feb 2024 21:41:12 -0700 Subject: [PATCH] tcmd: Accordion and popover md elements --- actions/temp.ts | 5 + app/globals.css | 8 +- app/layout.tsx | 5 +- app/page.tsx | 12 +- components/tcmd/index.tsx | 147 ++++++++++----- hooks/useDebounce.ts | 12 ++ hooks/useInput.ts | 40 +++++ hooks/useObjectState.ts | 126 +++++++++++++ hooks/useQueryParams.ts | 10 ++ hooks/useRefCallback.ts | 19 ++ lib/accordion/index.tsx | 80 +++++++++ lib/poppables/components/poppable-content.tsx | 170 ++++++++++++++++++ lib/poppables/components/poppable.tsx | 59 ++++++ lib/portal/components/index.ts | 27 +++ lib/tcmd/index.ts | 1 - lib/tcmd/inlineTokens.ts | 20 ++- lib/tcmd/tokenizeBlock.ts | 13 ++ lib/utils/bulkRound.ts | 1 + lib/utils/clamp.ts | 2 + tailwind.config.ts | 5 + test.md | 31 ++-- types.d.ts | 4 +- 22 files changed, 729 insertions(+), 68 deletions(-) create mode 100644 actions/temp.ts create mode 100644 hooks/useDebounce.ts create mode 100644 hooks/useInput.ts create mode 100644 hooks/useObjectState.ts create mode 100644 hooks/useQueryParams.ts create mode 100644 hooks/useRefCallback.ts create mode 100644 lib/accordion/index.tsx create mode 100644 lib/poppables/components/poppable-content.tsx create mode 100644 lib/poppables/components/poppable.tsx create mode 100644 lib/portal/components/index.ts create mode 100644 lib/utils/bulkRound.ts create mode 100644 lib/utils/clamp.ts diff --git a/actions/temp.ts b/actions/temp.ts new file mode 100644 index 0000000..57d4638 --- /dev/null +++ b/actions/temp.ts @@ -0,0 +1,5 @@ +"use server"; + +import { readFile } from "fs/promises"; + +export const readMD = async () => await readFile("./test.md", "utf-8"); diff --git a/app/globals.css b/app/globals.css index e53e6dc..361f316 100644 --- a/app/globals.css +++ b/app/globals.css @@ -8,7 +8,6 @@ } body { @apply dark:bg-mixed-100 bg-primary-600 - /* background: linear-gradient(47deg, black, #620072, #120072); */ } input { @apply py-2 px-4 rounded-full dark:bg-mixed-200 dark:bg-mixed-600 placeholder:text-dark-500 @@ -38,4 +37,11 @@ .btn-secondary { @apply text-primary-500 py-4 px-6 font-bold text-lg } + .p { + @apply py-1 + } + + .poppable { + @apply card bg-mixed-300 p-2 rounded-lg transition-opacity data-[visible=true]:z-10 data-[visible=true]:opacity-100 data-[visible=false]:opacity-0 -z-10 max-w-[400px] absolute + } } diff --git a/app/layout.tsx b/app/layout.tsx index ef1bd77..b73eff4 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -23,7 +23,7 @@ export default function RootLayout({ return ( -