([]);
+
+ const paperType = useWrite((state) => state.paperType);
+ const resetWrite = useWrite((state) => state.resetWrite);
+
+ // 답글 작성 과정에서 데이터 정제 + 답글작성시 api연결 해야함(백서버가 꺼져서 내일 진행2025.02.21)
+
+ // const LETTER_REQUEST: LetterRequest = {
+ // receiver: null,
+ // parentLetterId: null,
+ // title: letterTitle,
+ // content: letterText,
+ // category: searchParams,
+ // paperType: paperType,
+ // fontType: fontType,
+ // };
+
+ useEffect(() => {
+ const letterId = searchParams.get('letterId');
+ if (letterId) {
+ getPrevLetter(setPrevLetter, letterId);
+ }
+ }, [searchParams]);
+
+ useEffect(() => {
+ return () => {
+ resetWrite();
+ };
+ }, [resetWrite]);
+
+ useEffect(() => {
+ const navigationGuard = (e: BeforeUnloadEvent) => {
+ e.preventDefault();
+ };
+ window.addEventListener('beforeunload', navigationGuard);
+
+ return () => {
+ window.removeEventListener('beforeunload', navigationGuard);
+ };
+ }, []);
const wrapStyle = twMerge(
'relative p-5 w-full grow flex flex-col',
- `${step === 'edit' && THEME_OBJ[theme]}`,
+ `${step === 'edit' && PAPER_TYPE_OBJ[paperType]}`,
);
return (
diff --git a/src/stores/writeStore.ts b/src/stores/writeStore.ts
index 68df482..7f6f80a 100644
--- a/src/stores/writeStore.ts
+++ b/src/stores/writeStore.ts
@@ -5,29 +5,43 @@ interface WriteStore {
setLetterTitle: (typing: string) => void;
letterText: string;
setLetterText: (typing: string) => void;
- font: string;
- setFont: (selectedFont: string) => void;
- theme: Theme;
- setTheme: (selectedTheme: Theme) => void;
- stamp: Stamp;
- setStamp: (selectedStamp: Stamp) => void;
+ fontType: FontType;
+ setFontType: (selectedFontType: FontType) => void;
+ paperType: PaperType;
+ setPaperType: (selectedPaperType: PaperType) => void;
+ category: Category;
+ setCategory: (selectedCategory: Category) => void;
+ resetWrite: () => void;
}
const useWrite = create((set) => ({
letterTitle: '',
setLetterTitle: (typing) => set(() => ({ letterTitle: typing })),
+
letterText: '',
setLetterText: (typing) => set(() => ({ letterText: typing })),
- font: 'pretendard',
- setFont: (selectedFont) => {
- set(() => ({ font: selectedFont }));
+
+ fontType: 'DEFAULT',
+ setFontType: (selectedFontType) => {
+ set(() => ({ fontType: selectedFontType }));
},
- theme: '기본',
- setTheme: (selectedTheme) =>
+
+ paperType: 'BASIC',
+ setPaperType: (selectedPaperType) =>
+ set(() => ({
+ paperType: selectedPaperType,
+ })),
+
+ category: 'CONSOLATION',
+ setCategory: (selectedCategory) => set(() => ({ category: selectedCategory })),
+
+ resetWrite: () =>
set(() => ({
- theme: selectedTheme,
+ letterTitle: '',
+ letterText: '',
+ fontType: 'DEFAULT',
+ paperType: 'BASIC',
+ category: 'CONSOLATION',
})),
- stamp: '위로와 공감',
- setStamp: (selectedStamp) => set(() => ({ stamp: selectedStamp })),
}));
export default useWrite;
diff --git a/src/styles/components.css b/src/styles/components.css
index ea78961..74af716 100644
--- a/src/styles/components.css
+++ b/src/styles/components.css
@@ -30,8 +30,10 @@
background-blend-mode: overlay, normal;
}
+ .wrapper-box-shadow {
+ box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.25);
+ }
.message-header {
@apply text-gray-60 w-fit rounded-full bg-white px-6 py-4;
}
-
}
diff --git a/src/styles/preflight.css b/src/styles/preflight.css
index d51f42e..c74f27a 100644
--- a/src/styles/preflight.css
+++ b/src/styles/preflight.css
@@ -16,7 +16,7 @@
overflow-y: scroll;
overflow-x: hidden;
/* 그라데이션 배경 들어가는 곳 */
- background:
+ /* background:
url('/src/assets/images/background-overlay.png') repeat,
linear-gradient(
180deg,
@@ -26,10 +26,10 @@
)
fixed,
#f2f2f2;
- background-blend-mode: overlay, normal, normal;
+ background-blend-mode: overlay, normal, normal; */
}
- #root {
+ /* #root {
display: flex;
flex-direction: column;
max-width: 600px;
@@ -37,7 +37,7 @@
min-height: calc(var(--vh, 1vh) * 100);
margin: 0 auto;
position: relative;
- }
+ } */
button {
cursor: pointer;
@@ -47,3 +47,29 @@
outline: none;
}
}
+
+/* 모바일용 레이어로 분리 */
+@layer components {
+ .mobile-bg {
+ background:
+ url('/src/assets/images/background-overlay.png') repeat,
+ linear-gradient(
+ 180deg,
+ rgba(234, 191, 23, 0.5) 2.83%,
+ rgba(255, 245, 221, 0.5) 35.47%,
+ rgba(255, 251, 248, 0.5) 55.48%
+ )
+ fixed,
+ #f2f2f2;
+ background-blend-mode: overlay, normal, normal;
+ }
+ .mobile-layout {
+ display: flex;
+ flex-direction: column;
+ max-width: 600px;
+ width: 100%;
+ min-height: calc(var(--vh, 1vh) * 100);
+ margin: 0 auto;
+ position: relative;
+ }
+}
diff --git a/src/styles/typography.css b/src/styles/typography.css
index 045f203..d09a879 100644
--- a/src/styles/typography.css
+++ b/src/styles/typography.css
@@ -11,12 +11,36 @@
line-height: 36px;
}
+ .h2-r {
+ font-size: 24px;
+ font-weight: 400;
+ line-height: 36px;
+ }
+
+ .h2-l {
+ font-size: 24px;
+ font-weight: 300;
+ line-height: 36px;
+ }
+
.h3-b {
font-size: 20px;
font-weight: 700;
line-height: 30px;
}
+ .h3-sb {
+ font-size: 20px;
+ font-weight: 600;
+ line-height: 30px;
+ }
+
+ .h3-r {
+ font-size: 20px;
+ font-weight: 400;
+ line-height: 30px;
+ }
+
.body-l-b {
font-size: 16px;
font-weight: 700;
diff --git a/src/types/letterDetail.d.ts b/src/types/letterDetail.d.ts
new file mode 100644
index 0000000..d3aaaa1
--- /dev/null
+++ b/src/types/letterDetail.d.ts
@@ -0,0 +1,8 @@
+interface LetterDetail {
+ letterId: number;
+ title: string;
+ content: string;
+ category: 'CONSOLATION' | 'CELEBRATION' | 'CONSULT' | 'ETC';
+ paperType: PaperType;
+ fontType: FontType;
+}
diff --git a/src/types/random.d.ts b/src/types/random.d.ts
index 29881b5..558d0e9 100644
--- a/src/types/random.d.ts
+++ b/src/types/random.d.ts
@@ -1,4 +1,4 @@
interface SelectedLetter {
- stampName: Stamp;
+ categoryName: Category;
title: string;
}
diff --git a/src/types/write.d.ts b/src/types/write.d.ts
index e1ceaeb..5c7f026 100644
--- a/src/types/write.d.ts
+++ b/src/types/write.d.ts
@@ -1,32 +1,64 @@
-type Stamp = '위로와 공감' | '축하와 응원' | '고민 상담' | '기타' | '답변자';
+type Category = 'CONSOLATION' | 'CELEBRATION' | 'CONSULT' | 'ETC' | '답변자';
type Option = '편지지' | '글꼴' | '이전 편지 내용' | null;
type Step = 'edit' | 'category';
-type Theme = '기본' | '축하' | '위로' | '빈티지' | '들판';
+type PaperType = 'BASIC' | 'CELEBRATE' | 'COMFORT' | 'PAPER' | 'FIELD';
+type FontType = 'KYOBO' | 'GYEONGGI' | 'HIMCHAN' | 'DEFAULT';
-interface ThemeInfo {
- name: Theme;
- src: string;
+interface PaperTypeObj {
+ BASIC: string;
+ CELEBRATE: string;
+ COMFORT: string;
+ PAPER: string;
+ FIELD: string;
}
-interface ThemeObj {
- 기본: string;
- 축하: string;
- 위로: string;
- 빈티지: string;
- 들판: string;
+
+interface Fonts {
+ fontType: FontType;
+ fontName: string;
+ fontFamily: string;
}
-interface Stamps {
- '축하와 응원': string;
- '위로와 공감': string;
- '고민 상담': string;
- 기타: string;
+interface PrevLetter {
+ letterId: number;
+ title: string;
+ content: string;
+ paperType: PaperType;
+ fontType: FontType;
+}
+
+interface Categorys {
+ CONSOLATION: string;
+ CELEBRATION: string;
+ CONSULT: string;
+ ETC: string;
답변자: string;
}
+interface CategoryList {
+ paperType: PaperType;
+ name: string;
+ src: string;
+}
+
interface CategoryStamps {
- title: Stamp;
+ category: Category;
+ title: string;
image: string;
}
-// 이전 편지 임시 타입 지정
-type PrevLetter = any[] | null;
+// API 타입
+interface LetterRequest {
+ receiver: number | null;
+ parentLetterId: number | null;
+ title: string;
+ content: string;
+ category: Category;
+ paperType: PaperType;
+ fontType: FontType;
+}
+
+// 기존 설정 타입들
+// type Stamp = '위로와 공감' | '축하와 응원' | '고민 상담' | '기타' | '답변자';
+// type Option = '편지지' | '글꼴' | '이전 편지 내용' | null;
+// type Step = 'edit' | 'category';
+// type Theme = '기본' | '축하' | '위로' | '빈티지' | '들판';