Merge branch 'main' of https://github.com/devaine/CodeRED-Astra into mincy
This commit is contained in:
commit
ded3e57e29
5 changed files with 35 additions and 14 deletions
|
|
@ -3,9 +3,17 @@ import { ArrowDown } from "lucide-react";
|
|||
import { motion } from "motion/react";
|
||||
|
||||
export default function DownButton({ onClick }) {
|
||||
function handleClick(e) {
|
||||
if (onClick) return onClick(e);
|
||||
// default behavior: scroll to bottom of page smoothly
|
||||
const doc = document.documentElement;
|
||||
const top = Math.max(doc.scrollHeight, document.body.scrollHeight);
|
||||
window.scrollTo({ top, behavior: "smooth" });
|
||||
}
|
||||
|
||||
return (
|
||||
<motion.button
|
||||
onClick={onClick}
|
||||
onClick={handleClick}
|
||||
className="bg-gray-700 p-2 rounded-2xl file-input border-2 border-gray-600 size-10"
|
||||
whileHover={{ scale: 1.1 }}
|
||||
whileTap={{ scale: 0.9 }}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,13 @@ export default function MessageInput({ onSend }) {
|
|||
ta.style.height = `${ta.scrollHeight}px`;
|
||||
}
|
||||
}}
|
||||
onKeyDown={(e) => {
|
||||
// Enter to submit, Shift+Enter for newline
|
||||
if (e.key === "Enter" && !e.shiftKey) {
|
||||
e.preventDefault();
|
||||
handleSubmit(e);
|
||||
}
|
||||
}}
|
||||
placeholder="Type a message..."
|
||||
rows={1}
|
||||
className="flex-1 mx-2 rounded-md shadow-2sx border-none focus:border-none focus:outline-none resize-none overflow-auto max-h-40"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue