From 3bce6731172c60edaf9f5ea97a7b3c84d29a0507 Mon Sep 17 00:00:00 2001 From: Sahaj Jain Date: Sun, 4 May 2025 23:58:25 +0530 Subject: [PATCH] fix: Clickable mention-list --- .../components/ai-generate-dialog.tsx | 3 +- components/editor/mention-list.tsx | 47 ++++++++++--------- 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/components/editor/action-bar/components/ai-generate-dialog.tsx b/components/editor/action-bar/components/ai-generate-dialog.tsx index 9f0556b1..fee1f161 100644 --- a/components/editor/action-bar/components/ai-generate-dialog.tsx +++ b/components/editor/action-bar/components/ai-generate-dialog.tsx @@ -52,7 +52,8 @@ export function AIGenerateDialog({ How can I help you theme? - Ask for anything in plain english, I'll make it happen. + Use @ to mention a preset or + your current theme. diff --git a/components/editor/mention-list.tsx b/components/editor/mention-list.tsx index 736dee7e..7f44084b 100644 --- a/components/editor/mention-list.tsx +++ b/components/editor/mention-list.tsx @@ -31,6 +31,7 @@ export const MentionList = forwardRef( // Function to select item (adapted from reference) const selectItem = (index: number) => { + console.log("selectItem", index); const item = props.items[index]; if (item) { // Pass the whole item object to the command function @@ -84,32 +85,34 @@ export const MentionList = forwardRef( className={cn( "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95" )} + style={{ position: "absolute", pointerEvents: "auto" }} > - { - props.items.length ? ( - props.items.map((item, index) => ( - - )) - ) : ( -
( +
- ) // Use Tailwind classes for the empty state, styled like an item, using cn - } + {item.label} + + )) + ) : ( +
+ No result +
+ )} ); }