Skip to content

Commit

Permalink
refactor(frontend): Improve chat input padding (#4928)
Browse files Browse the repository at this point in the history
  • Loading branch information
amanape authored Nov 14, 2024
1 parent 01cacf7 commit 89b304c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
8 changes: 5 additions & 3 deletions frontend/src/components/chat-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ interface ChatInputProps {
onBlur?: () => void;
onImagePaste?: (files: File[]) => void;
className?: React.HTMLAttributes<HTMLDivElement>["className"];
buttonClassName?: React.HTMLAttributes<HTMLButtonElement>["className"];
}

export function ChatInput({
Expand All @@ -35,6 +36,7 @@ export function ChatInput({
onBlur,
onImagePaste,
className,
buttonClassName,
}: ChatInputProps) {
const textareaRef = React.useRef<HTMLTextAreaElement>(null);
const [isDraggingOver, setIsDraggingOver] = React.useState(false);
Expand Down Expand Up @@ -100,7 +102,7 @@ export function ChatInput({
return (
<div
data-testid="chat-input"
className="flex items-end justify-end grow gap-1 min-h-6"
className="flex items-end justify-end grow gap-1 min-h-6 w-full"
>
<TextareaAutosize
ref={textareaRef}
Expand Down Expand Up @@ -128,7 +130,7 @@ export function ChatInput({
)}
/>
{showButton && (
<>
<div className={buttonClassName}>
{button === "submit" && (
<button
aria-label="Send"
Expand All @@ -152,7 +154,7 @@ export function ChatInput({
<div className="w-[10px] h-[10px] bg-white" />
</button>
)}
</>
</div>
)}
</div>
);
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/interactive-chat-box.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function InteractiveChatBox({
<div
className={cn(
"flex items-end gap-1",
"bg-neutral-700 border border-neutral-600 rounded-lg px-2 py-[10px]",
"bg-neutral-700 border border-neutral-600 rounded-lg px-2",
"transition-colors duration-200",
"hover:border-neutral-500 focus-within:border-neutral-500",
)}
Expand All @@ -71,6 +71,8 @@ export function InteractiveChatBox({
onStop={onStop}
value={value}
onImagePaste={handleUpload}
className="py-[10px]"
buttonClassName="py-[10px]"
/>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/upload-image-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function UploadImageInput({ onUpload, label }: UploadImageInputProps) {
};

return (
<label className="cursor-pointer">
<label className="cursor-pointer py-[10px]">
{label || <Clip data-testid="default-label" width={24} height={24} />}
<input
data-testid="upload-image-input"
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/routes/_oh._index/task-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export function TaskForm() {
/>
<div
className={cn(
"border border-neutral-600 px-4 py-[17px] rounded-lg text-[17px] leading-5 w-full transition-colors duration-200",
"border border-neutral-600 px-4 rounded-lg text-[17px] leading-5 w-full transition-colors duration-200",
inputIsFocused ? "bg-neutral-600" : "bg-neutral-700",
"hover:border-neutral-500 focus-within:border-neutral-500",
)}
Expand All @@ -91,7 +91,8 @@ export function TaskForm() {
value={text}
maxRows={15}
showButton={!!text}
className="text-[17px] leading-5"
className="text-[17px] leading-5 py-[17px]"
buttonClassName="pb-[17px]"
disabled={navigation.state === "submitting"}
/>
</div>
Expand Down

0 comments on commit 89b304c

Please sign in to comment.