@@ -3,7 +3,15 @@ import { useNavigate, useParams } from 'react-router';
33import { twMerge } from 'tailwind-merge' ;
44
55import { deleteLetter , getLetter } from '@/apis/letterDetail' ;
6- import { CloudIcon , SirenOutlinedIcon , SnowIcon , ThermostatIcon , WarmIcon } from '@/assets/icons' ;
6+ import {
7+ CloudIcon ,
8+ DeleteIcon ,
9+ SirenOutlinedIcon ,
10+ SnowIcon ,
11+ ThermostatIcon ,
12+ WarmIcon ,
13+ } from '@/assets/icons' ;
14+ import BackButton from '@/components/BackButton' ;
715import ReportModal from '@/components/ReportModal' ;
816import { FONT_TYPE_OBJ , PAPER_TYPE_OBJ } from '@/pages/Write/constants' ;
917
@@ -34,7 +42,6 @@ const LetterDetailPage = () => {
3442 if ( params . id ) {
3543 getLetter ( params . id , setLetterDetail ) ;
3644 // 편지 삭제 요청 테스트(내일 삭제 버튼 만들어서 여기다 추가하긔)
37- deleteLetter ( params . id ) ;
3845 }
3946
4047 return ( ) => {
@@ -50,42 +57,52 @@ const LetterDetailPage = () => {
5057 letterDetail && PAPER_TYPE_OBJ [ letterDetail . paperType ] ,
5158 ) }
5259 >
53- < div className = "absolute top-5 right-5 flex gap-3" >
54- < button
55- ref = { degreeButtonRef }
56- className = "flex items-center justify-center gap-1"
57- onClick = { ( ) => {
58- setDegreeModalOpen ( ( cur ) => ! cur ) ;
59- } }
60- >
61- < ThermostatIcon className = "h-6 w-6" />
62- < span className = "caption-b text-primary-1" > 편지 온도</ span >
63- </ button >
64- < button
65- onClick = { ( ) => {
66- setReportModalOpen ( true ) ;
67- } }
68- >
69- < SirenOutlinedIcon className = "text-primary-1 h-6 w-6" />
70- </ button >
71- { degreeModalOpen && (
72- < div className = "caption-b text-primary-1 bg-primary-5 absolute top-7 z-40 flex flex-col gap-1 p-2 shadow" >
73- { DEGREES . map ( ( degree , idx ) => {
74- return (
75- < button
76- key = { idx }
77- className = "flex items-center justify-start gap-1"
78- onClick = { ( ) => {
79- console . log ( idx ) ;
80- } }
81- >
82- { degree . icon }
83- { degree . title }
84- </ button >
85- ) ;
86- } ) }
87- </ div >
88- ) }
60+ < div className = "absolute top-5 left-0 flex w-full justify-between px-5" >
61+ < BackButton />
62+ < div className = "flex gap-2" >
63+ < button
64+ ref = { degreeButtonRef }
65+ className = "flex items-center justify-center gap-1"
66+ onClick = { ( ) => {
67+ setDegreeModalOpen ( ( cur ) => ! cur ) ;
68+ } }
69+ >
70+ < ThermostatIcon className = "h-6 w-6" />
71+ < span className = "caption-b text-primary-1" > 편지 온도</ span >
72+ </ button >
73+ < button
74+ onClick = { ( ) => {
75+ if ( params . id ) deleteLetter ( params . id ) ;
76+ } }
77+ >
78+ < DeleteIcon className = "text-primary-1 h-6 w-6" />
79+ </ button >
80+ < button
81+ onClick = { ( ) => {
82+ setReportModalOpen ( true ) ;
83+ } }
84+ >
85+ < SirenOutlinedIcon className = "text-primary-1 h-6 w-6" />
86+ </ button >
87+ { degreeModalOpen && (
88+ < div className = "caption-b text-primary-1 bg-primary-5 absolute top-7 z-40 flex flex-col gap-1 p-2 shadow" >
89+ { DEGREES . map ( ( degree , idx ) => {
90+ return (
91+ < button
92+ key = { idx }
93+ className = "flex items-center justify-start gap-1"
94+ onClick = { ( ) => {
95+ console . log ( idx ) ;
96+ } }
97+ >
98+ { degree . icon }
99+ { degree . title }
100+ </ button >
101+ ) ;
102+ } ) }
103+ </ div >
104+ ) }
105+ </ div >
89106 </ div >
90107 < div className = "flex flex-col gap-3 px-5" >
91108 < span className = "body-b mt-[55px]" > TO. 따숨이</ span >
0 commit comments