diff --git a/public/me.png b/public/me.png new file mode 100644 index 0000000..2be2cb7 Binary files /dev/null and b/public/me.png differ diff --git a/src/@types/data.d.ts b/src/@types/data.d.ts index e160a3f..80a041b 100644 --- a/src/@types/data.d.ts +++ b/src/@types/data.d.ts @@ -72,6 +72,14 @@ export interface ResultPackageType { image: string; desc: string; category: string; + backgroundImg: string; +} + +export interface lastAnswersType { + golf: string; + trekking: string; + ocean: string; + culture: string; } export interface TestResultProductType { diff --git a/src/commons/Chatbot/ChatList.tsx b/src/commons/Chatbot/ChatList.tsx new file mode 100644 index 0000000..bef4c2d --- /dev/null +++ b/src/commons/Chatbot/ChatList.tsx @@ -0,0 +1,78 @@ +import React, { useState } from "react"; +import styled from "styled-components"; +import { TimeFormatEnum, currentTime } from "../../utils/CurrentTime"; +import { useRecoilState } from "recoil"; +import { chatListState } from "../../store/chatbotAtom"; + +type ChatPropsType = { + startTime: string; +}; + +const ChatList = ({ startTime }: ChatPropsType) => { + const [chatList, setChatList] = useRecoilState(chatListState); + + return ( + +
{"오늘 " + startTime}
+
sdfdsfsd
+
sdfdsfsd
+
sdfdsfsd
+
sdfdsfsd
+
sdfdsfsd
+
sdfdsfsd
+
sdfdsfsd
+
sdfdsfsd
+
sdfdsfsd
+
sdfdsfsd
+
sdfdsfsd
+
sdfdsfsd
+
sdfdsfsd
+
sdfdsfsd
+
sdfdsfsd
+
sdfdsfsd
+
sdfdsfsd
+
sdfdsfsd
+
sdfdsfsd
+
sdfdsfsd
+
sdfdsfsd
+
sdfdsfsd
+
sdfdsfsd
+
sdfdsfsd
+
sdfdsfsd
+
sdfdsfsd
+
+ ); +}; + +const ChatListContainer = styled.div` + height: 430px; + overflow: auto; + padding: 0 10px; + + ::-webkit-scrollbar { + width: 10px; + } + + ::-webkit-scrollbar-thumb { + height: 30%; + background: var(--color-blue); + border-radius: 8px; + } + + ::-webkit-scrollbar-track { + background: rgba(126, 126, 126, 0.432); + border-radius: 8px; + } + + .start-time { + text-align: center; + margin-bottom: 15px; + color: var(--color-blue); + } + + @media (max-width: 850px) { + height: 300px; + } +`; + +export default ChatList; diff --git a/src/commons/Chatbot/FloatingInput.tsx b/src/commons/Chatbot/FloatingInput.tsx index 16433b2..12fccb6 100644 --- a/src/commons/Chatbot/FloatingInput.tsx +++ b/src/commons/Chatbot/FloatingInput.tsx @@ -1,42 +1,53 @@ import { useState } from "react"; import styled from "styled-components"; import { IoIosPaperPlane } from "react-icons/io"; -import { useMediaQuery } from "react-responsive"; import { answers } from "./questionsAndAnswers"; +import { chatListState, chatbotStepState } from "../../store/chatbotAtom"; +import { useRecoilState } from "recoil"; -type PropsType = { - setMyMessage: any; +type FloatingInputPropsType = { orderNumber: number; + setOrderNumber: any; + answer: string[]; + setAnswer: any; }; -const FloatingInput = ({ setMyMessage, orderNumber }: PropsType) => { - const isMobile: boolean = useMediaQuery({ - query: "(max-width:850px)", - }); - // 질문 3번째부터는 text input 대신 button형식으로 변경하기 - - const [text, setText] = useState(""); - - const onSubmit = (e: React.FormEvent) => { - console.log(text); - setMyMessage(text); - setText(""); +const FloatingInput = ({ + orderNumber, + setOrderNumber, + answer, + setAnswer, +}: FloatingInputPropsType) => { + const [chatbotStep, setChatbotStep] = useRecoilState(chatbotStepState); + const [chatList, setChatList] = useRecoilState(chatListState); + const [selectedButton, setSelectedButton] = useState([]); + + const onSubmit = (aaa: string[]) => { + console.log(aaa); + setChatList({ chatList: [] }); + // setAnswer(""); + + if (orderNumber === 7) { + // api연결코드 작성 + setChatbotStep({ step: 3 }); + } }; return ( - {orderNumber < 2 ? ( + {orderNumber > 2 ? ( //< { e.preventDefault(); - onSubmit(e); + let aaa: string[] = []; + onSubmit(aaa); }} > setText(e.target.value)} + value={answer} + onChange={(e) => setAnswer(e.target.value)} />