Skip to content

Commit

Permalink
refactor: CommandInput > focusRef, scrollIntoViewRef 유틸 함수 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
YuHyun-P committed Dec 13, 2023
1 parent a5416cc commit 18e7766
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/frontend/src/components/terminal/CommandInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {
useRef,
} from "react";

import { focusRef, scrollIntoViewRef } from "../../utils/refObject";

import Prompt from "./Prompt";
import * as styles from "./Terminal.css";

Expand All @@ -27,10 +29,10 @@ const CommandInput = forwardRef<ForwardRefType, CommandInputProps>(
ref,
() => ({
focus(options) {
inputRef.current?.focus(options);
focusRef(inputRef, options);
},
scrollIntoView(arg) {
inputRef.current?.scrollIntoView(arg);
scrollIntoViewRef(inputRef, arg);
},
}),
[],
Expand Down Expand Up @@ -59,7 +61,7 @@ const CommandInput = forwardRef<ForwardRefType, CommandInputProps>(
};

const handleClick = () => {
inputRef.current?.focus();
focusRef(inputRef);
};

return (
Expand Down

0 comments on commit 18e7766

Please sign in to comment.