Skip to content

Commit 4f48252

Browse files
authored
Merge pull request #20 from MBTips/feature/MessageInput-컴포넌트-개발
feat: ChatAction 컴포넌트 개발
2 parents 8e7abe5 + 8425a87 commit 4f48252

File tree

10 files changed

+88
-8
lines changed

10 files changed

+88
-8
lines changed

public/icon/close.svg

Lines changed: 1 addition & 0 deletions
Loading

public/icon/plus.svg

Lines changed: 4 additions & 0 deletions
Loading

public/icon/plus_button.svg

Lines changed: 0 additions & 5 deletions
This file was deleted.

public/icon/submit_action.svg

Lines changed: 5 additions & 0 deletions
Loading

public/icon/submit_disabled.svg

Lines changed: 5 additions & 0 deletions
Loading

src/App.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
import Alert from "./components/Alert";
2-
31
function App() {
4-
return <Alert />;
2+
return <></>;
53
}
64

75
export default App;

src/components/ChatAction.tsx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { ChangeEvent, useState } from "react";
2+
import ToggleChatTipsButton from "@/components/button/ToggleChatTipsButton";
3+
import MessageInput from "@/components/input/MessageInput";
4+
5+
const ChatAction = () => {
6+
const [isOpen, setIsOpen] = useState(false);
7+
const [value, setValue] = useState("");
8+
9+
const handleChange = (e: ChangeEvent<HTMLInputElement>) => {
10+
setValue(e.target.value);
11+
};
12+
13+
return (
14+
<div className="flex justify-around items-center bg-white px-5 py-3.5 border-[1px] border-gray-100 w-full h-[68px]">
15+
<ToggleChatTipsButton isOpen={isOpen} setIsOpen={setIsOpen} />
16+
<MessageInput value={value} onChange={handleChange} />
17+
<img
18+
className="ml-4"
19+
src={value ? "/icon/submit_action.svg" : "/icon/submit_disabled.svg"}
20+
alt="메시지 제출"
21+
width={40}
22+
height={40}
23+
/>
24+
</div>
25+
);
26+
};
27+
28+
export default ChatAction;
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
interface ToggleChatTipsButtonProps {
2+
isOpen: boolean;
3+
setIsOpen: (isOpen: boolean) => void;
4+
}
5+
6+
const ToggleChatTipsButton = ({
7+
isOpen,
8+
setIsOpen
9+
}: ToggleChatTipsButtonProps) => {
10+
return (
11+
<img
12+
src={isOpen ? "/icon/close.svg" : "/icon/plus.svg"}
13+
onClick={() => setIsOpen(!isOpen)}
14+
alt="토글 메뉴 버튼"
15+
width={14}
16+
height={14}
17+
/>
18+
);
19+
};
20+
21+
export default ToggleChatTipsButton;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { ChangeEvent } from "react";
2+
3+
interface MessageInputProps {
4+
value: string;
5+
onChange: (e: ChangeEvent<HTMLInputElement>) => void;
6+
}
7+
8+
const MessageInput = ({ value, onChange }: MessageInputProps) => {
9+
return (
10+
<input
11+
className="bg-gray-50 ml-2.5 px-4 py-2.5 rounded-[40px] w-[257px] h-[44px] font-medium text-2lg text-gray-900 placeholder:text-gray-600"
12+
placeholder="메시지를 입력해주세요."
13+
value={value}
14+
onChange={onChange}
15+
/>
16+
);
17+
};
18+
19+
export default MessageInput;

src/index.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ body {
6161
min-height: 100vh;
6262
}
6363

64+
input:focus {
65+
outline: none;
66+
}
67+
6468
@keyframes pulse-custom {
6569

6670
0%,

0 commit comments

Comments
 (0)