diff --git a/index.html b/index.html
index f0c8806..e4b78ea 100644
--- a/index.html
+++ b/index.html
@@ -4,10 +4,6 @@
-
alert("눌렸습니다")}
>
diff --git a/src/components/common/FriendBook/FriendBook.styled.ts b/src/components/common/FriendBook/FriendBook.styled.ts
index a619669..3c6e5f5 100644
--- a/src/components/common/FriendBook/FriendBook.styled.ts
+++ b/src/components/common/FriendBook/FriendBook.styled.ts
@@ -1,20 +1,21 @@
import styled from "styled-components";
export const FriendDiv = styled.div`
- width: 60%;
+ width: 100%;
height: 200px;
background-color: white;
border: 1px solid #eaeaea;
box-shadow: ${({ theme }) => theme.boxShadow.bookShadow};
border-radius: 4px;
display: flex;
- justify-content: center;
+ position: relative;
align-items: center;
+ cursor: pointer;
`;
export const FriendLCoverDiv = styled.div`
width: 30%;
- height: 200px;
+ height: 100%;
background-color: ${({ theme }) => theme.color.point};
border-radius: 4px;
display: flax;
@@ -27,9 +28,11 @@ export const FriendRCoverDiv = styled.div`
height: 20px;
background-color: ${({ theme }) => theme.color.point};
border-radius: 4px;
- display: flax;
+ display: flex;
flex-direction: center;
align-items: center;
+ position: absolute;
+ right: 0;
`;
export const FriendTextDiv = styled.div`
diff --git a/src/components/common/FriendBook/index.tsx b/src/components/common/FriendBook/index.tsx
index 486ed96..f0aa3df 100644
--- a/src/components/common/FriendBook/index.tsx
+++ b/src/components/common/FriendBook/index.tsx
@@ -1,12 +1,9 @@
-import React from "react";
-import styled from "styled-components";
import * as S from "./FriendBook.styled";
export interface Props {
- friendId: number;
title: string;
onClick: () => void;
}
-const FriendBook = ({ friendId, title, onClick }: Props) => {
+const FriendBook = ({ title, onClick }: Props) => {
return (
diff --git a/src/components/common/Input/Input/Input.styled.ts b/src/components/common/Input/Input/Input.styled.ts
index bdd24ba..2731ebb 100644
--- a/src/components/common/Input/Input/Input.styled.ts
+++ b/src/components/common/Input/Input/Input.styled.ts
@@ -30,6 +30,10 @@ export const InputArea = styled.input<{ inputWidth: string }>`
border: none;
outline: none;
font-size: ${({ theme }) => theme.fontSize.large};
+
+ &:disabled {
+ background-color: ${({ theme }) => theme.color.background};
+ }
`;
export const InputLabel = styled.span<{
diff --git a/src/components/common/Input/TextArea/TextArea.styled.ts b/src/components/common/Input/TextArea/TextArea.styled.ts
index 7690d61..2a47d8c 100644
--- a/src/components/common/Input/TextArea/TextArea.styled.ts
+++ b/src/components/common/Input/TextArea/TextArea.styled.ts
@@ -7,6 +7,10 @@ export const TextArea = styled.textarea<{ inputWidth: string }>`
font-size: ${({ theme }) => theme.fontSize.large};
resize: none;
height: 100%;
+
+ &:disabled {
+ background-color: ${({ theme }) => theme.color.background};
+ }
`;
export const InputLabel = styled.span<{
diff --git a/src/hooks/api/auth/usePostLogin.ts b/src/hooks/api/auth/usePostLogin.ts
index 97b37fd..1f74567 100644
--- a/src/hooks/api/auth/usePostLogin.ts
+++ b/src/hooks/api/auth/usePostLogin.ts
@@ -1,5 +1,6 @@
import { useToast } from "@/hooks/useToast";
import { instance, post } from "@/libs/api";
+import { queryClient } from "@/libs/queryClient";
import { UserState } from "@/store";
import { LoginRequest, LoginResponse } from "@/types/user";
@@ -26,8 +27,8 @@ export const useLogin = () => {
mutationFn: (params: LoginRequest) => postLogin(params),
onSuccess: ({ res }) => {
- console.log("res", res);
toastOpen("환영합니다");
+ queryClient.clear();
setTimeout(() => {
setUser(res.data);
// 토큰 저장
diff --git a/src/hooks/api/auth/usePostSignUp.ts b/src/hooks/api/auth/usePostSignUp.ts
index e74ae5b..b645c08 100644
--- a/src/hooks/api/auth/usePostSignUp.ts
+++ b/src/hooks/api/auth/usePostSignUp.ts
@@ -19,7 +19,7 @@ export const useSignUp = () => {
onSuccess: ({ res }) => {
console.log("res", res);
- toastOpen("생성되었습니다");
+ toastOpen("가입되었습니다.");
setTimeout(() => {
navigate("/auth/login", {
diff --git a/src/hooks/api/diary/useGetListByFriendId.ts b/src/hooks/api/diary/useGetListByFriendId.ts
new file mode 100644
index 0000000..2440feb
--- /dev/null
+++ b/src/hooks/api/diary/useGetListByFriendId.ts
@@ -0,0 +1,20 @@
+import { get } from "@/libs/api";
+import { DiaryContent } from "@/types/diary";
+import { queryKeys } from "@/utils/constants";
+import { useQuery } from "@tanstack/react-query";
+
+const getDiaryByFriendId = async (friendId: number) => {
+ const res = await get<{ data: DiaryContent[] }>(
+ `/apis/v1/diary/read/friend/${friendId}?page=100&size=100`
+ );
+
+ return { data: res.data };
+};
+export const useGetListByFriendId = (friendId: number) => {
+ const { data } = useQuery({
+ queryFn: () => getDiaryByFriendId(friendId),
+ queryKey: [queryKeys.diaryList, friendId],
+ });
+
+ return { data };
+};
diff --git a/src/hooks/api/diary/useSubmitDiary.ts b/src/hooks/api/diary/useSubmitDiary.ts
new file mode 100644
index 0000000..2a98b37
--- /dev/null
+++ b/src/hooks/api/diary/useSubmitDiary.ts
@@ -0,0 +1,42 @@
+import useCurrentUser from "@/hooks/useAuth";
+import { useToast } from "@/hooks/useToast";
+import { post } from "@/libs/api";
+import { queryClient } from "@/libs/queryClient";
+import { useMutation } from "@tanstack/react-query";
+import { useNavigate } from "react-router-dom";
+
+interface ISubmitDiary {
+ title: string;
+ content: string;
+ sing: "";
+ friendId: number;
+}
+const submitDiary = async (id: number, params: ISubmitDiary) => {
+ const res = await post(`/apis/v1/diary/create?id=${id}`, params);
+ console.log("res");
+ return { res }; // 성공적인 경우 데이터 반환
+};
+
+export const useSubmitDiary = () => {
+ const { toastOpen, toastClose, toastMessage } = useToast();
+ const navigate = useNavigate();
+ const { currentUser } = useCurrentUser();
+
+ const { mutate } = useMutation({
+ mutationFn: (params: ISubmitDiary) =>
+ submitDiary(currentUser.senderId, params),
+
+ onSuccess: ({ res }) => {
+ console.log("res", res);
+ toastOpen("일기 작성에 성공했습니다");
+ queryClient.clear();
+ setTimeout(() => {
+ navigate("/");
+ }, 1000);
+ },
+ onError: () => {
+ toastOpen("오류가 발생했습니다");
+ },
+ });
+ return { mutate, toastClose, toastMessage };
+};
diff --git a/src/hooks/api/main/useGetFriend.ts b/src/hooks/api/main/useGetFriend.ts
index 475c320..c907740 100644
--- a/src/hooks/api/main/useGetFriend.ts
+++ b/src/hooks/api/main/useGetFriend.ts
@@ -1,14 +1,14 @@
import { get } from "@/libs/api";
-import { FriendList } from "@/types/friend";
+import { FriendInfo } from "@/types/friend";
import { queryKeys } from "@/utils/constants";
import { useQuery } from "@tanstack/react-query";
const getFriendList = async (memberId: number) => {
- const res = await get<{ data: FriendList }>(
+ const res = await get<{ data: FriendInfo[] }>(
`/apis/v1/friends/list?memberId=${memberId}`
);
- return { res: res.data };
+ return { data: res.data };
};
export const useGetFriend = (memberId: number) => {
diff --git a/src/hooks/api/mypage/useGetFriendAccept.ts b/src/hooks/api/mypage/useGetFriendAccept.ts
deleted file mode 100644
index dadabd6..0000000
--- a/src/hooks/api/mypage/useGetFriendAccept.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-import { get } from "@/libs/api";
-import { FriendList } from "@/types/friend";
-import { queryKeys } from "@/utils/constants";
-import { useQuery } from "@tanstack/react-query";
-
-const getFriendAccept = async (memberId: number) => {
- const res = await get<{ data: FriendList }>(
- `/apis/v1/friends/request?memberId=${memberId}`
- );
- console.log("res", res);
- return { data: res.data };
-};
-
-export const useGetFriendAccept = (memberId: number) => {
- const { data } = useQuery({
- queryFn: () => getFriendAccept(memberId),
- queryKey: [queryKeys.friendAccept, memberId],
- });
-
- return { data };
-};
diff --git a/src/hooks/api/request/useRequestFriend.ts b/src/hooks/api/request/useRequestFriend.ts
index 0214a6e..d62e793 100644
--- a/src/hooks/api/request/useRequestFriend.ts
+++ b/src/hooks/api/request/useRequestFriend.ts
@@ -1,6 +1,7 @@
import useCurrentUser from "@/hooks/useAuth";
import { useToast } from "@/hooks/useToast";
import { post } from "@/libs/api";
+import { queryClient } from "@/libs/queryClient";
import { FriendRequest } from "@/types/request";
import { useMutation } from "@tanstack/react-query";
import { useNavigate } from "react-router-dom";
@@ -23,6 +24,7 @@ export const useRequestFriend = () => {
onSuccess: ({ res }) => {
console.log("res", res);
toastOpen("친구 요청 성공했습니다");
+ queryClient.clear();
setTimeout(() => {
navigate("/");
}, 1000);
diff --git a/src/libs/api.ts b/src/libs/api.ts
index 0bac7d5..6a7aa61 100644
--- a/src/libs/api.ts
+++ b/src/libs/api.ts
@@ -29,8 +29,7 @@ const interceptorRequestFulfilled = (config: AxiosRequestConfig) => {
...config,
headers: {
"Content-Type": "application/json",
- // Authorization: `Bearer ${TOKEN}`,
- // Cookie: `token=${TOKEN}`,
+ Authorization: `${TOKEN}`,
} as AxiosRequestHeaders,
};
} else {
diff --git a/src/pages/auth/Login.tsx b/src/pages/auth/Login.tsx
index 834702c..14ddbd6 100644
--- a/src/pages/auth/Login.tsx
+++ b/src/pages/auth/Login.tsx
@@ -8,6 +8,7 @@ import PasswrodIcon from "@/assets/svg/icon-auth-password.svg";
import PasswordShowIcon from "@/assets/svg/icon-auth-passwordShow.svg";
import Button from "@/components/common/Button";
import styled from "styled-components";
+import { StyledDiv, StyledH1 } from "@/styles/common";
const Login = () => {
const location = useLocation();
@@ -43,7 +44,7 @@ const Login = () => {
return (
<>
-
+
로그인
{
onChangeValue={onChangeName}
leftIcon={NameIcon}
/>
-
{
})),
}}
/>
-
{
{toastMessage.message}
-
+
>
);
};
export default Login;
-export const LoginDiv = styled.div`
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- width: 100%;
- height: 100dvh;
- gap: 10px;
-`;
-
const StyledInput = styled(Input)`
padding: 10px;
margin: 10px;
@@ -115,11 +104,6 @@ const StyledButton = styled(Button)`
margin: 20px;
`;
-const StyledH1 = styled.div`
- padding: 100px;
- font-size: 60pt;
-`;
-
const P = styled.p`
cursor: pointer;
`;
diff --git a/src/pages/auth/Signup.tsx b/src/pages/auth/Signup.tsx
index b557d2b..12add29 100644
--- a/src/pages/auth/Signup.tsx
+++ b/src/pages/auth/Signup.tsx
@@ -7,7 +7,7 @@ import PasswordShowIcon from "@/assets/svg/icon-auth-passwordShow.svg";
import NameIcon from "@/assets/svg/icon-auth-name.svg";
import Button from "@/components/common/Button";
import { useNavigate } from "react-router-dom";
-import styled from "styled-components";
+import { P, StyledDiv, StyledH1 } from "@/styles/common";
const Signup = () => {
const navigate = useNavigate();
@@ -52,16 +52,15 @@ const Signup = () => {
return (
<>
-
+
회원가입
-
-
- {
})),
}}
/>
-
- {
})),
}}
/>
-
- {
}
>
회원가입
-
+
{
navigate("/auth/login");
@@ -114,7 +111,7 @@ const Signup = () => {
>
이미 계정이 있으신가요?
-
+
{toastMessage.message}
@@ -123,29 +120,3 @@ const Signup = () => {
};
export default Signup;
-
-export const SignupDiv = styled.div`
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- width: 100%;
- height: 100dvh;
- gap: 10px;
-`;
-
-const StyledInput = styled(Input)`
- margin: 10px 0;
-`;
-
-const StyledButton = styled(Button)`
- margin: 20px 0;
-`;
-
-const StyledH1 = styled.div`
- padding: 100px;
- font-size: 60pt;
-`;
-const P = styled.p`
- cursor: pointer;
-`;
diff --git a/src/pages/diary/$id.tsx b/src/pages/diary/$id.tsx
index 9822095..9cd006e 100644
--- a/src/pages/diary/$id.tsx
+++ b/src/pages/diary/$id.tsx
@@ -1,7 +1,58 @@
-import React from "react";
+import List from "@/components/List";
+import Button from "@/components/common/Button";
+import { useGetListByFriendId } from "@/hooks/api/diary/useGetListByFriendId";
+import { DiaryDetailState, FriendInfoState } from "@/store";
+import { useNavigate } from "react-router-dom";
+import { useRecoilValue, useSetRecoilState } from "recoil";
+import { styled } from "styled-components";
const Detail = () => {
- return Detail
;
+ const navigate = useNavigate();
+ const friendInfo = useRecoilValue(FriendInfoState);
+ const { data } = useGetListByFriendId(friendInfo.friendId || 0);
+ const setDiaryDetail = useSetRecoilState(DiaryDetailState);
+ return (
+
+ {data?.data?.map((el) => (
+ <>
+ {
+ setDiaryDetail(el);
+ navigate("/diary");
+ }}
+ />
+ >
+ ))}
+
+
+
+
+ );
};
export default Detail;
+
+const Wrapper = styled.div`
+ display: flex;
+ flex-direction: column;
+ width: 100%;
+ min-height: 100%;
+ position: relative;
+ /* justify-content: center; */
+ /* align-items: center; */
+`;
+
+const ButtonWrapper = styled.div`
+ position: absolute;
+ width: 100%;
+ bottom: 10px;
+`;
diff --git a/src/pages/diary/Update.tsx b/src/pages/diary/Update.tsx
deleted file mode 100644
index 6fe204a..0000000
--- a/src/pages/diary/Update.tsx
+++ /dev/null
@@ -1,141 +0,0 @@
-import { ChangeEvent, useState, useRef, useEffect } from "react";
-import { useLocation, useNavigate } from "react-router-dom";
-import styled from "styled-components";
-import Toast from "@/components/common/Toast";
-import Input from "@/components/common/Input/Input";
-import Button from "@/components/common/Button";
-import TextArea from "@/components/common/Input/TextArea";
-
-const Update = () => {
- const location = useLocation();
- const navigate = useNavigate();
-
- const [writeState, setWriteState] = useState<"create" | "update">("create");
- const [title, setTitle] = useState("");
- const [content, setContent] = useState("");
- const [sing, setSing] = useState("");
- const [date, setDate] = useState("");
-
- const handleEditButton = () => {
- mutate({
- title: "",
- content: "",
- sing: "",
- date: "",
- });
- };
-
- const handleCancelButton = () => {
- navigate(-1);
- };
-
- const onChangeTitle = (e: ChangeEvent) => {
- setTitle(e.target.value);
- };
- const onChangeContent = (e: ChangeEvent) => {
- setContent(e.target.value);
- };
-
- const onChangeSing = (e: ChangeEvent) => {
- setSing(e.target.value);
- };
- const onChangeDate = (e: ChangeEvent) => {
- setDate(e.target.value);
- };
-
- useEffect(() => {
- if (location && location.state?.update) {
- setWriteState("update");
- // todo : 다이어리 글 상태관리
- } else {
- setWriteState("create");
- }
- }, [location]);
-
- return (
- <>
-
- 일기 {writeState === "create" ? "작성" : "수정"}
-
-
-
-
-
-
-
-
-
-
-
-
-
- >
- );
-};
-
-export default Update;
-
-export const CreateDiv = styled.div`
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- height: 100%;
- width: 100%;
-`;
-
-function mutate(arg0: {
- title: string;
- content: string;
- sing: string;
- date: string;
-}) {
- throw new Error("Function not implemented.");
-}
-
-const StyledH1 = styled.div`
- padding: 50px;
- font-size: 60pt;
-`;
-
-const ButtonWrapper = styled.div`
- display: flex;
- gap: 10px;
- width: 100%;
-`;
diff --git a/src/pages/diary/Write.tsx b/src/pages/diary/Write.tsx
index 5f1fd39..b21e2e3 100644
--- a/src/pages/diary/Write.tsx
+++ b/src/pages/diary/Write.tsx
@@ -1,27 +1,30 @@
-import { ChangeEvent, useState, useRef, useEffect } from "react";
+import { ChangeEvent, useState, useEffect } from "react";
import { useLocation, useNavigate } from "react-router-dom";
-import styled from "styled-components";
import Toast from "@/components/common/Toast";
import Input from "@/components/common/Input/Input";
import Button from "@/components/common/Button";
import TextArea from "@/components/common/Input/TextArea";
+import { useSubmitDiary } from "@/hooks/api/diary/useSubmitDiary";
+import { useRecoilValue } from "recoil";
+import { FriendInfoState } from "@/store";
+import { StyledDiv, StyledH1, TwoButtonWrapper } from "@/styles/common";
const Write = () => {
const location = useLocation();
const navigate = useNavigate();
-
+ const friendInfo = useRecoilValue(FriendInfoState);
const [writeState, setWriteState] = useState<"create" | "update">("create");
const [title, setTitle] = useState("");
const [content, setContent] = useState("");
- const [sing, setSing] = useState("");
- const [date, setDate] = useState("");
- const handleEditButton = () => {
+ const { mutate, toastClose, toastMessage } = useSubmitDiary();
+
+ const onClick = () => {
mutate({
- title: "",
- content: "",
+ title: title,
+ content: content,
sing: "",
- date: "",
+ friendId: friendInfo.friendId,
});
};
@@ -36,17 +39,9 @@ const Write = () => {
setContent(e.target.value);
};
- const onChangeSing = (e: ChangeEvent) => {
- setSing(e.target.value);
- };
- const onChangeDate = (e: ChangeEvent) => {
- setDate(e.target.value);
- };
-
useEffect(() => {
if (location && location.state?.update) {
setWriteState("update");
- // todo : 다이어리 글 상태관리
} else {
setWriteState("create");
}
@@ -54,38 +49,29 @@ const Write = () => {
return (
<>
-
+
일기 {writeState === "create" ? "작성" : "수정"}
-
-
-
-
-
-
-
+ /> */}
+
@@ -93,49 +79,22 @@ const Write = () => {
buttonColor="main"
buttonStyle="default"
onClick={() => {
- navigate("/");
+ onClick();
}}
disabled={
!title || // 제목이 없거나
- !content || // 내용이 없거나
- !date // 날짜가 없을 경우
+ !content // 내용이 없거나
}
>
{writeState === "create" ? "작성하기" : "수정하기"}
-
-
+
+
+
+ {toastMessage.message}
+
>
);
};
export default Write;
-
-export const CreateDiv = styled.div`
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- height: 100%;
- width: 100%;
-`;
-
-function mutate(arg0: {
- title: string;
- content: string;
- sing: string;
- date: string;
-}) {
- throw new Error("Function not implemented.");
-}
-
-const StyledH1 = styled.div`
- padding: 50px;
- font-size: 60pt;
-`;
-
-const ButtonWrapper = styled.div`
- display: flex;
- gap: 10px;
- width: 100%;
-`;
diff --git a/src/pages/diary/index.tsx b/src/pages/diary/index.tsx
index 63dddeb..3632886 100644
--- a/src/pages/diary/index.tsx
+++ b/src/pages/diary/index.tsx
@@ -1,7 +1,37 @@
+import Input from "@/components/common/Input/Input";
+import TextArea from "@/components/common/Input/TextArea";
+import { DiaryDetailState } from "@/store";
+import { StyledDiv } from "@/styles/common";
import React from "react";
+import { useRecoilValue } from "recoil";
+import Button from "@/components/common/Button";
+import { useNavigate } from "react-router-dom";
-const index = () => {
- return hi
;
+const Diary = () => {
+ const navigate = useNavigate();
+ const diaryDetail = useRecoilValue(DiaryDetailState);
+
+ return (
+
+ {}}
+ disabled={true}
+ />
+
+ );
};
-export default index;
+export default Diary;
diff --git a/src/pages/index.tsx b/src/pages/index.tsx
index 8689eb0..e1cc5be 100644
--- a/src/pages/index.tsx
+++ b/src/pages/index.tsx
@@ -1,13 +1,43 @@
+import FriendBook from "@/components/common/FriendBook";
import { useGetFriend } from "@/hooks/api/main/useGetFriend";
import useCurrentUser from "@/hooks/useAuth";
-import React from "react";
+import { FriendInfoState } from "@/store";
+import { StyledH1 } from "@/styles/common";
+import { useNavigate } from "react-router-dom";
+import { useSetRecoilState } from "recoil";
const Main = () => {
const { currentUser } = useCurrentUser();
const { data } = useGetFriend(currentUser.senderId);
console.log("data", data);
- return {currentUser?.senderName}의 책장
;
+ const navigate = useNavigate();
+ const setFriendInfo = useSetRecoilState(FriendInfoState);
+ return (
+ <>
+ {currentUser?.senderName}의 책장
+
+ {data?.data.map((el) => (
+ <>
+ {
+ setFriendInfo(el);
+ navigate(`/diary/${el.friendId}`);
+ }}
+ />
+ >
+ ))}
+
+ >
+ );
};
export default Main;
diff --git a/src/pages/mypage/index.tsx b/src/pages/mypage/index.tsx
index ca86209..d66e148 100644
--- a/src/pages/mypage/index.tsx
+++ b/src/pages/mypage/index.tsx
@@ -1,5 +1,5 @@
import Button from "@/components/common/Button";
-import { useGetFriendAccept } from "@/hooks/api/mypage/useGetFriendAccept";
+// import { useGetFriendAccept } from "@/hooks/api/mypage/useGetFriendAccept";
import useCurrentUser from "@/hooks/useAuth";
import React from "react";
import { useNavigate } from "react-router-dom";
@@ -7,9 +7,7 @@ import { styled } from "styled-components";
const MyPage = () => {
const navigate = useNavigate();
- const { currentUser, resetUser } = useCurrentUser();
-
- const { data } = useGetFriendAccept(currentUser.senderId);
+ const { resetUser } = useCurrentUser();
const onClickLogout = () => {
navigate("/auth/login");
@@ -17,10 +15,8 @@ const MyPage = () => {
resetUser();
};
- console.log("data", data);
return (
- 친구 요청 N
{
navigate("/request");
diff --git a/src/pages/mypage/list.tsx b/src/pages/mypage/list.tsx
deleted file mode 100644
index 447af50..0000000
--- a/src/pages/mypage/list.tsx
+++ /dev/null
@@ -1,82 +0,0 @@
-import { useLocation, useNavigate } from "react-router-dom";
-import { ChangeEvent, useState, useRef, useEffect } from "react";
-import styled from "styled-components";
-import HeartIcon from "@/assets/svg/Heart.svg";
-
-const list = () => {
- const location = useLocation();
- const navigate = useNavigate();
-
- const [title, setTitle] = useState("");
- const [date, setDate] = useState("");
-
- const handleEditButton = () => {
- mutate({
- title: "",
- date: "",
- });
- };
-
- return (
- <>
-
- 제목: {title}
-
- 날짜: {date}
- 🤍 6
- 💬 5
-
-
- 제목: {title}
-
- 날짜: {date}
- 🤍 6
- 💬 5
-
-
- 제목: {title}
-
- 날짜: {date}
- 🤍 6
- 💬 5
-
-
- 제목: {title}
-
- 날짜: {date}
- 🤍 6
- 💬 5
-
- >
- );
-};
-
-export default list;
-
-function mutate(arg0: { title: string; date: string }) {
- throw new Error("Function not implemented.");
-}
-
-export const ListDiv = styled.div`
- width: 100%;
- height: 100px;
- margin-top: 100px;
- padding: 10px;
- border-bottom: ${({ theme }) => theme.boxBorder.bookBorder};
- border-radius: 4px;
- display: flex;
- align-items: center;
- justify-content: space-between;
-`;
-
-const StyledH3 = styled.div`
- margin-left: 20px;
- padding: 10px;
- font-size: 30pt;
-`;
-
-const StyledH5 = styled.div`
- margin-right: 300px;
- padding: 10px;
- font-size: 20pt;
-`;
diff --git a/src/pages/request/index.tsx b/src/pages/request/index.tsx
index bbda264..092e685 100644
--- a/src/pages/request/index.tsx
+++ b/src/pages/request/index.tsx
@@ -2,8 +2,8 @@ import Button from "@/components/common/Button";
import Input from "@/components/common/Input/Input";
import Toast from "@/components/common/Toast";
import { useRequestFriend } from "@/hooks/api/request/useRequestFriend";
+import { StyledDiv, StyledH1 } from "@/styles/common";
import React, { ChangeEvent, useState } from "react";
-import { styled } from "styled-components";
const Request = () => {
const [friendName, setFriendName] = useState("");
@@ -27,7 +27,7 @@ const Request = () => {
};
return (
-
+
친구 추가하기
{
placeholder="교환일기 제목을 입력해주세요"
onChangeValue={onChangeTitle}
/>
-
친구 추가하기
-
-
+
{toastMessage.message}
-
+
);
};
export default Request;
-
-export const LoginDiv = styled.div`
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- width: 100%;
- height: 100%;
- gap: 10px;
-`;
-
-const StyledButton = styled(Button)`
- margin: 20px;
-`;
-
-const StyledH1 = styled.div`
- padding: 50px;
- font-size: 60pt;
- white-space: pre;
-`;
diff --git a/src/store/index.ts b/src/store/index.ts
index e5ae3f4..6b4b49c 100644
--- a/src/store/index.ts
+++ b/src/store/index.ts
@@ -1,3 +1,5 @@
+import { DiaryContent } from "@/types/diary";
+import { FriendInfo } from "@/types/friend";
import { User } from "@/types/user";
import { atom, selector } from "recoil";
import { recoilPersist } from "recoil-persist";
@@ -23,3 +25,15 @@ export const UserIdState = selector({
return user?.senderId || 0;
},
});
+
+export const FriendInfoState = atom({
+ key: "FriendInfoState",
+ default: undefined,
+ effects_UNSTABLE: [persistAtom],
+});
+
+export const DiaryDetailState = atom({
+ key: "DiaryDetailState",
+ default: undefined,
+ effects_UNSTABLE: [persistAtom],
+});
diff --git a/src/styles/common.ts b/src/styles/common.ts
new file mode 100644
index 0000000..22b6837
--- /dev/null
+++ b/src/styles/common.ts
@@ -0,0 +1,26 @@
+import { styled } from "styled-components";
+
+export const StyledH1 = styled.div`
+ font-size: 30pt;
+ white-space: pre;
+`;
+
+export const StyledDiv = styled.div`
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ width: 100%;
+ height: 100dvh;
+ gap: 10px;
+`;
+
+export const P = styled.p`
+ cursor: pointer;
+`;
+
+export const TwoButtonWrapper = styled.div`
+ display: flex;
+ gap: 10px;
+ width: 100%;
+`;
diff --git a/src/types/diary.ts b/src/types/diary.ts
new file mode 100644
index 0000000..404cc3b
--- /dev/null
+++ b/src/types/diary.ts
@@ -0,0 +1,8 @@
+export interface DiaryContent {
+ diaryId: number;
+ title: string;
+ content: string;
+ sing: string;
+ heartCount: number;
+ friendName: string;
+}
diff --git a/src/types/friend.ts b/src/types/friend.ts
index 4940e93..3f9bb02 100644
--- a/src/types/friend.ts
+++ b/src/types/friend.ts
@@ -1,7 +1,7 @@
/**
* 메인 책장
*/
-export interface FriendList {
+export interface FriendInfo {
senderId: number;
receiverId: number;
senderName: string;
@@ -10,3 +10,15 @@ export interface FriendList {
title: string;
friendId: number;
}
+
+/**
+ * 요청보낸친구리스트
+ */
+
+export interface AcceptFriendList {
+ memberId: number;
+ receiverId: number;
+ status: string;
+ title: string;
+ friendId: number;
+}
diff --git a/src/utils/constants.ts b/src/utils/constants.ts
index 4b5ec52..847e71c 100644
--- a/src/utils/constants.ts
+++ b/src/utils/constants.ts
@@ -1,6 +1,6 @@
export const queryKeys = {
friendList: "friendList",
- friendAccept: "friendAccept",
+ diaryList: "friendiaryListdAccept",
};
export const storageConstants = {