Skip to content

Commit

Permalink
fix: sroll down button overlaping chat input (mckaywrigley#564)
Browse files Browse the repository at this point in the history
  • Loading branch information
santi4o authored Apr 18, 2023
1 parent 51fa461 commit 00f6189
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
14 changes: 3 additions & 11 deletions components/Chat/Chat.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IconArrowDown, IconClearAll, IconSettings } from '@tabler/icons-react';
import { IconClearAll, IconSettings } from '@tabler/icons-react';
import {
MutableRefObject,
memo,
Expand Down Expand Up @@ -492,24 +492,16 @@ export const Chat = memo(({ stopConversationRef }: Props) => {
setCurrentMessage(message);
handleSend(message, 0, plugin);
}}
onScrollDownClick={handleScrollDown}
onRegenerate={() => {
if (currentMessage) {
handleSend(currentMessage, 2, null);
}
}}
showScrollDownButton={showScrollDownButton}
/>
</>
)}
{showScrollDownButton && (
<div className="absolute bottom-0 right-0 mb-4 mr-4 pb-20">
<button
className="flex h-7 w-7 items-center justify-center rounded-full bg-neutral-300 text-gray-800 shadow-md hover:shadow-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-neutral-200"
onClick={handleScrollDown}
>
<IconArrowDown size={18} />
</button>
</div>
)}
</div>
);
});
Expand Down
16 changes: 16 additions & 0 deletions components/Chat/ChatInput.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
IconArrowDown,
IconBolt,
IconBrandGoogle,
IconPlayerStop,
Expand Down Expand Up @@ -30,15 +31,19 @@ import { VariableModal } from './VariableModal';
interface Props {
onSend: (message: Message, plugin: Plugin | null) => void;
onRegenerate: () => void;
onScrollDownClick: () => void;
stopConversationRef: MutableRefObject<boolean>;
textareaRef: MutableRefObject<HTMLTextAreaElement | null>;
showScrollDownButton: boolean;
}

export const ChatInput = ({
onSend,
onRegenerate,
onScrollDownClick,
stopConversationRef,
textareaRef,
showScrollDownButton
}: Props) => {
const { t } = useTranslation('chat');

Expand Down Expand Up @@ -341,6 +346,17 @@ export const ChatInput = ({
)}
</button>

{showScrollDownButton && (
<div className="absolute bottom-12 right-0 lg:bottom-0 lg:-right-10">
<button
className="flex h-7 w-7 items-center justify-center rounded-full bg-neutral-300 text-gray-800 shadow-md hover:shadow-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-neutral-200"
onClick={onScrollDownClick}
>
<IconArrowDown size={18} />
</button>
</div>
)}

{showPromptList && filteredPrompts.length > 0 && (
<div className="absolute bottom-12 w-full">
<PromptList
Expand Down

0 comments on commit 00f6189

Please sign in to comment.