diff --git a/Mine/src/components/NewMagazineInput.tsx b/Mine/src/components/NewMagazineInput.tsx new file mode 100644 index 0000000..a9d6a5d --- /dev/null +++ b/Mine/src/components/NewMagazineInput.tsx @@ -0,0 +1,65 @@ +import { type KeyboardEvent } from 'react' + +interface MagazineInputProps { + topic: string + userMood: string + onTopicChange: (value: string) => void + onUserMoodChange: (value: string) => void + onSubmit: () => void +} + +export default function NewMagazineInput({ + topic, + userMood, + onTopicChange, + onUserMoodChange, + onSubmit, +}: MagazineInputProps) { + const handleKeyDown = (e: KeyboardEvent) => { + if (e.key === 'Enter' && !e.shiftKey) { + e.preventDefault() + onSubmit() + } + } + + return ( +
+
+
+ 주제 + onTopicChange(e.target.value)} + onKeyDown={handleKeyDown} + placeholder="관심있는 주제를 입력해 주세요." + className="w-full bg-transparent font-regular16 text-gray-100 outline-none placeholder-gray-100/40" + /> +
+
+ +
+
+ 분위기 + onUserMoodChange(e.target.value)} + onKeyDown={handleKeyDown} + placeholder="원하는 분위기를 입력해 주세요." + className="w-full bg-transparent font-regular16 text-gray-100 outline-none placeholder-gray-100/40" + /> +
+ +
+
+ ) +} diff --git a/Mine/src/pages/main/MainPage.tsx b/Mine/src/pages/main/MainPage.tsx index 54776f9..da438ba 100644 --- a/Mine/src/pages/main/MainPage.tsx +++ b/Mine/src/pages/main/MainPage.tsx @@ -1,37 +1,49 @@ -import LLMInputBox from '../../components/LLMInputBox' +import { useState } from 'react' import usePostMagazine from '../../hooks/usePostMagazine' +import landingBg from '../../assets/bg1.jpg' +import NewMagazineInput from '../../components/NewMagazineInput' +import MakingLoadingPage from './MakingLoadingPage' export default function MainPage() { const postMagazineMutation = usePostMagazine() const isLoading = postMagazineMutation.isPending + const [topic, setTopic] = useState('') + const [userMood, setUserMood] = useState('') - const handleSend = (value: string) => { - console.log('전송 내용:', value) - - postMagazineMutation.mutate({ topic: value, user_mood: '' }) + const handleSend = () => { + if (!topic.trim()) return + postMagazineMutation.mutate({ topic: topic, user_mood: userMood }) } return ( -
+
+
- 나만의 매거진을 만들어볼까요? + 나만의 매거진을 만들어볼까요?
- +
- {isLoading && ( -
-
-

- 당신만을 위한 매거진을 만들고 있어요... -

-
- )} + + {isLoading && }
) } diff --git a/Mine/src/pages/main/MakingLoadingPage.tsx b/Mine/src/pages/main/MakingLoadingPage.tsx new file mode 100644 index 0000000..10ca605 --- /dev/null +++ b/Mine/src/pages/main/MakingLoadingPage.tsx @@ -0,0 +1,10 @@ +export default function MakingLoadingPage() { + return ( +
+
+

+ 당신만을 위한 매거진을 만들고 있어요... +

+
+ ) +}